smile.stat.distribution
Class DiscreteMixture
- java.lang.Object
-
- smile.stat.distribution.AbstractDistribution
-
- smile.stat.distribution.DiscreteDistribution
-
- smile.stat.distribution.DiscreteMixture
-
- All Implemented Interfaces:
- Distribution
- Direct Known Subclasses:
- DiscreteExponentialFamilyMixture
public class DiscreteMixture extends DiscreteDistribution
The finite mixture of discrete distributions.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static classDiscreteMixture.ComponentA component in the mixture distribution is defined by a distribution and its weight in the mixture.
-
Constructor Summary
Constructors Constructor and Description DiscreteMixture(java.util.List<DiscreteMixture.Component> mixture)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description doublebic(double[] data)BIC score of the mixture for given data.doublecdf(double x)Cumulative distribution function.doubleentropy()Shannon entropy.java.util.List<DiscreteMixture.Component>getComponents()Returns the list of components in the mixture.doublelogp(int x)The probability mass function in log scale.doublemean()The mean of distribution.intnpara()The number of parameters of the distribution.doublep(int x)The probability mass function.doublequantile(double p)The quantile, the probability to the left of quantile is p.doublerand()Generates a random number following this distribution.doublesd()The standard deviation of distribution.intsize()Returns the number of components in the mixture.java.lang.StringtoString()doublevar()The variance of distribution.-
Methods inherited from class smile.stat.distribution.DiscreteDistribution
likelihood, logLikelihood, logp, p
-
Methods inherited from class smile.stat.distribution.AbstractDistribution
likelihood, logLikelihood
-
-
-
-
Constructor Detail
-
DiscreteMixture
public DiscreteMixture(java.util.List<DiscreteMixture.Component> mixture)
Constructor.- Parameters:
mixture- a list of discrete distributions.
-
-
Method Detail
-
mean
public double mean()
Description copied from interface:DistributionThe mean of distribution.
-
var
public double var()
Description copied from interface:DistributionThe variance of distribution.
-
sd
public double sd()
Description copied from interface:DistributionThe standard deviation of distribution.
-
entropy
public double entropy()
Shannon entropy. Not supported.
-
p
public double p(int x)
Description copied from class:DiscreteDistributionThe probability mass function.- Specified by:
pin classDiscreteDistribution
-
logp
public double logp(int x)
Description copied from class:DiscreteDistributionThe probability mass function in log scale.- Specified by:
logpin classDiscreteDistribution
-
cdf
public double cdf(double x)
Description copied from interface:DistributionCumulative distribution function. That is the probability to the left of x.
-
rand
public double rand()
Description copied from interface:DistributionGenerates a random number following this distribution.
-
quantile
public double quantile(double p)
Description copied from interface:DistributionThe quantile, the probability to the left of quantile is p. It is actually the inverse of cdf.
-
npara
public int npara()
Description copied from interface:DistributionThe number of parameters of the distribution.
-
size
public int size()
Returns the number of components in the mixture.
-
bic
public double bic(double[] data)
BIC score of the mixture for given data.
-
getComponents
public java.util.List<DiscreteMixture.Component> getComponents()
Returns the list of components in the mixture.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-
DataMelt 3.0 © DataMelt by jWork.ORG