From the previous issue on calculations for pointwise_loglikelihood:
What do you expect pointwise_loglikelihoods to compute here? The marginal likelihood for each dimension? If so, I don't think this is what you want for something like LOO-PIS.
EDIT: If y is a Matrix, it makes a bit more sense, and in that case you can use either a for loop or .~ (for MultvariateDistribution, .~ assumes each column represents an observation).
I'm unsure if this is the most intuitive behavior. The problem here is that, in general, the rows of a table represent independent observations, while each column is a different attribute. My suggestion would be to use the following set of rules for .~ broadcasting:
- If the object being broadcasted over is a table from Tables.jl and is not an Array, Turing should recognize that each row is an independent observation for the purposes of
pointwise_loglikelihood and any similar functions. (Although internally, it should be treated as a broadcast over columns -- this should improve performance, since columns usually have only one type.)
- If the object is an array, not from Tables.jl, and not square, broadcasting over columns is safe --
.~ will throw a dimension mismatch if the user meant to broadcast over rows. We can assume the user meant to broadcast over columns because Julia is column major without risking too much.
- If the object being broadcasted over is square and not a Table, or if it is both a Table and an Array, an error should be thrown.
This is annoying given Julia is column-major, but I think it's the best solution to avoid errors in data analysis.
From the previous issue on calculations for
pointwise_loglikelihood:I'm unsure if this is the most intuitive behavior. The problem here is that, in general, the rows of a table represent independent observations, while each column is a different attribute. My suggestion would be to use the following set of rules for
.~broadcasting:pointwise_loglikelihoodand any similar functions. (Although internally, it should be treated as a broadcast over columns -- this should improve performance, since columns usually have only one type.).~will throw a dimension mismatch if the user meant to broadcast over rows. We can assume the user meant to broadcast over columns because Julia is column major without risking too much.This is annoying given Julia is column-major, but I think it's the best solution to avoid errors in data analysis.