haifengl / smile

Statistical Machine Intelligence & Learning Engine
https://haifengl.github.io
Other
6.05k stars 1.13k forks source link

Multinormial distribution #141

Closed leo-xin closed 7 years ago

leo-xin commented 7 years ago

Hi, Li, I wonder if there is a multinormial distribution implemetation in smile.stat.distribution? I can not find it in source, is there a plan to write one?

haifengl commented 7 years ago

multinomial or multi-variate normal/Gaussian distribution? We don't have multinomial but have MultiVariateGaussian. BTW, smile.classification.NaiveBayes supports multinomial model. Is it what you are looking for?

leo-xin commented 7 years ago

oh,sorry. I have a mis-spelling in the issue. I mean multinomial distribution, not multi Gaussian. It is a generalization of binomial distribution. I want to simulate a series of random trial from that distribution.

haifengl commented 7 years ago

So what you care is the random number generation?

haifengl commented 7 years ago

If all you need is that multinomial random number generator, there is a function in smile.math.Math

public static int random(double[] prob)

Given a set of n probabilities, it will generate a random number in [0, n).

leo-xin commented 7 years ago

yes, I have It according to your instruction. That is just what I want, thank you so much.

haifengl commented 7 years ago

You are welcome!