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 DiscreteMixture
DiscreteMixture.Component -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal doubleThe BIC score when the distribution is fit on a sample data.final doubleThe log-likelihood when the distribution is fit on a sample data.Fields inherited from class DiscreteMixture
components -
Constructor Summary
ConstructorsConstructorDescriptionConstructor. -
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 DiscreteMixture
bic, cdf, entropy, length, logp, map, mean, p, posteriori, quantile, rand, size, toString, varianceMethods inherited from class DiscreteDistribution
likelihood, logLikelihood, logp, p, quantile, randi, randiMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface 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.
-