jmschrei / pomegranate

Fast, flexible and easy to use probabilistic modelling in Python.
http://pomegranate.readthedocs.org/en/latest/
MIT License
3.35k stars 589 forks source link

[BUG] Normal distribution with single dimension does not work #1055

Closed YuriOsokin closed 2 months ago

YuriOsokin commented 1 year ago

Describe the bug Single dimension normal distribution does not work in pomegranate 1.0.0.

To Reproduce

  NormalDistribution([1.], [1.])

raises the error

  RuntimeError: linalg.cholesky: The input tensor A must have at least 2 dimensions.
christer-watson commented 4 months ago

The following code works and probably does what you want: distributions.Normal([1.],[[1.]])

jmschrei commented 4 months ago

You can also try adding covariance_type='diag'. It should probably default to that if the means/covars are only 1D but it currently assumes a full covariance matrix.