twodlearn.bayesnet.distributions module

class twodlearn.bayesnet.distributions.MVN(**kargs)[source]

Bases: twodlearn.core.common.TdlModel

multivariate normal distribution

batch_shape[source]
covariance[source]

covariance matrix

dynamic_batch_shape[source]
dynamic_event_shape[source]
dynamic_shape[source]
event_shape[source]
loc[source]

mean of the distribution

log_prob(value)[source]
mean[source]
sample(sample_shape=None)[source]
scale[source]

scale matrix y = loc + scale * e covariance = scale * scale^t

shape[source]

shape of the distribution The shape assumes the last dimention corresponds to a set of mvn vectors. Shape is divided as [batch_shape, event_shape]. Event shape is the shape of the samples for a single distribution. Batch_shape corresponds to the number of independent MVN distributions.

stddev[source]
tolerance[source]

added tolerance to the covariance, useful when optimizing over the covariance

class twodlearn.bayesnet.distributions.MVNDiag(**kargs)[source]

Bases: twodlearn.bayesnet.distributions.MVN

multivariate normal distribution

diag[source]
sample(sample_shape)[source]
stddev[source]
class twodlearn.bayesnet.distributions.MVNScaledIdentity(**kargs)[source]

Bases: twodlearn.bayesnet.distributions.MVNDiag

Multivariate Normal Distribution with Scaled Identity covariance.

Scale correspond to the covariance scale, shape is required.

Parameters are instantiated as Trainable by default

tdl.bayesnet.distributions.MVNScaledIdentity(
            shape=[10], scale=0.5)

To instantiate parameters as tensors (not trainable) use AutoInit classes:

tdl.bayesnet.distributions.MVNScaledIdentity(
    shape=[10],
    scale=(0.5, tdl.AutoTensor()), # initialize scale using 0.5 tensor
    loc=tdl.AutoTensor()) # initialize scale using the default value (0)
class twodlearn.bayesnet.distributions.Normal(loc, scale, name='McNormal', **kargs)[source]

Bases: twodlearn.core.common.TdlModel

normal distribution x= loc + scale*e, where e sim N(0, I)

loc[source]

mean of the distribution

scale[source]

standard deviation of the distribution

twodlearn.bayesnet.distributions.is_diagonal(x)[source]

Helper to identify if LinearOperator has only a diagonal component.