CUQI-DTU / CUQIpy

https://cuqi-dtu.github.io/CUQIpy/
Apache License 2.0
45 stars 9 forks source link

RV: Rethink "name" attribute #29

Open nabriis opened 2 years ago

nabriis commented 2 years ago

See e.g. comments in #22.

Currently providing a name attribute to a density is mostly used to indicate a random variable following the density. That is x ~ pi(..).

However, this becomes murky when talking about Likelihoods, EvaluatedDensity and even JointDistribution. For example,

  1. Should the joint distribution even have a name? If so, what should it be? There is not a random variable associated with the joint distribution because its jointly defined over (x,y,z) etc.
  2. For a Stacked Joint distribution we redefine a new random variable [x ; y ; z] as a stacked version of each of the random variables from the joint. In this case it makes sense to associate a name to the stacked joint distribution.

A comment about likelihood and random variables.

Suppose we define y ~ N(x, 1). Here we really mean that we defined a random variable y that conditionally on x follows a normal distribution. Hence we do not know the distribution of y only of y|x.

However, if we fix x we get a likelihood function L_y(x) := p(y|x). Here it does not make sense (afaik) to talk about a random variable associated with the likelihood. The likelihood function is simply an un-normalized density. No reason to attach a name.

In the code we do use the name to keep track of likelihoods and where they came from (y in this case). But we could find another approach to keep track of these.

amal-ghamdi commented 1 year ago

.