Package smile.stat.distribution
Class DiscreteExponentialFamilyMixture
java.lang.Object
smile.stat.distribution.DiscreteDistribution
smile.stat.distribution.DiscreteMixture
smile.stat.distribution.DiscreteExponentialFamilyMixture
- All Implemented Interfaces:
Serializable
,Distribution
The finite mixture of distributions from discrete exponential family.
The EM algorithm is provided to learn the mixture model from data.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class smile.stat.distribution.DiscreteMixture
DiscreteMixture.Component
-
Field Summary
Modifier and TypeFieldDescriptionfinal double
The BIC score when the distribution is fit on a sample data.final double
The log-likelihood when the distribution is fit on a sample data.Fields inherited from class smile.stat.distribution.DiscreteMixture
components
-
Constructor Summary
ConstructorDescriptionConstructor. -
Method Summary
Modifier and TypeMethodDescriptionfit
(int[] x, DiscreteMixture.Component... components) Fits the mixture model with the EM algorithm.fit
(int[] x, DiscreteMixture.Component[] components, double gamma, int maxIter, double tol) Fits the mixture model with the EM algorithm.Methods inherited from class smile.stat.distribution.DiscreteMixture
bic, cdf, entropy, length, logp, map, mean, p, posteriori, quantile, rand, size, toString, variance
Methods inherited from class smile.stat.distribution.DiscreteDistribution
likelihood, logLikelihood, logp, p, quantile, randi, randi
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface smile.stat.distribution.Distribution
inverseTransformSampling, likelihood, logLikelihood, quantile, quantile, rand, rejectionSampling, sd
-
Field Details
-
L
public final double LThe log-likelihood when the distribution is fit on a sample data. -
bic
public final double bicThe BIC score when the distribution is fit on a sample data.
-
-
Constructor Details
-
DiscreteExponentialFamilyMixture
Constructor.- Parameters:
mixture
- a list of discrete exponential family distributions.
-
-
Method Details
-
fit
public static DiscreteExponentialFamilyMixture fit(int[] x, DiscreteMixture.Component... components) Fits the mixture model with the EM algorithm.- Parameters:
x
- the training data.components
- the initial configuration of mixture. Components may have different distribution form.- Returns:
- the distribution.
-
fit
public static DiscreteExponentialFamilyMixture fit(int[] x, DiscreteMixture.Component[] components, double gamma, int maxIter, double tol) Fits the mixture model with the EM algorithm.- Parameters:
x
- the training data.components
- the initial configuration.gamma
- the regularization parameter.maxIter
- the maximum number of iterations.tol
- the tolerance of convergence test.- Returns:
- the distribution.
-