[Haskell-cafe] multivariate normal distribution in Haskell?

Ben Gamari bgamari.foss at gmail.com
Sun Apr 14 21:57:17 CEST 2013


Bas de Haas <W.B.deHaas at uu.nl> writes:

> Dear List,
>
> I’m implementing a probabilistic model for recognising musical chords in
> Haskell. This model relies on a multivariate normal distribution. I’ve
> been searching the internet and mainly hackage for a Haskell library to
> do this for me, but so far I’ve been unsuccessful.
>
> What I’m looking for is a Haskell function that does exactly what the
> mvnpdf function in matlab does:
> http://www.mathworks.nl/help/stats/multivariate-normal-distribution.html
>
> Does anyone know a library that can help me out?
>
As you are likely aware, the trouble with the multivariate normal is the
required inversion of the covariance. If you make assumptions concerning
the nature of the covariance (e.g. force it to be diagonal or low
dimensional) the problem gets much easier. To treat the general, high
dimensional case, you pretty much need a linear algebra library
(e.g. HMatrix) to perform the inversion (and determinant for proper
normalization). Otherwise, implementing the function given the inverse
is quite straightforward.

Cheers,

- Ben



More information about the Haskell-Cafe mailing list