Class MixtureMultivariateRealDistribution<T extends MultivariateRealDistribution>
- java.lang.Object
-
- org.apache.commons.math4.legacy.distribution.AbstractMultivariateRealDistribution
-
- org.apache.commons.math4.legacy.distribution.MixtureMultivariateRealDistribution<T>
-
- Type Parameters:
T- Type of the mixture components.
- All Implemented Interfaces:
MultivariateRealDistribution
- Direct Known Subclasses:
MixtureMultivariateNormalDistribution
public class MixtureMultivariateRealDistribution<T extends MultivariateRealDistribution> extends AbstractMultivariateRealDistribution
Class for representing mixture model distributions.- Since:
- 3.1
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.commons.math4.legacy.distribution.MultivariateRealDistribution
MultivariateRealDistribution.Sampler
-
-
Constructor Summary
Constructors Constructor Description MixtureMultivariateRealDistribution(List<Pair<Double,T>> components)Creates a mixture model from a list of distributions and their associated weights.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MultivariateRealDistribution.SamplercreateSampler(org.apache.commons.rng.UniformRandomProvider rng)Creates a sampler.doubledensity(double[] values)Returns the probability density function (PDF) of this distribution evaluated at the specified pointx.List<Pair<Double,T>>getComponents()Gets the distributions that make up the mixture model.-
Methods inherited from class org.apache.commons.math4.legacy.distribution.AbstractMultivariateRealDistribution
getDimension, sample
-
-
-
-
Constructor Detail
-
MixtureMultivariateRealDistribution
public MixtureMultivariateRealDistribution(List<Pair<Double,T>> components)
Creates a mixture model from a list of distributions and their associated weights.- Parameters:
components- Distributions from which to sample.- Throws:
NotPositiveException- if any of the weights is negative.DimensionMismatchException- if not all components have the same number of variables.
-
-
Method Detail
-
density
public double density(double[] values)
Returns the probability density function (PDF) of this distribution evaluated at the specified pointx. In general, the PDF is the derivative of the cumulative distribution function. If the derivative does not exist atx, then an appropriate replacement should be returned, e.g.Double.POSITIVE_INFINITY,Double.NaN, or the limit inferior or limit superior of the difference quotient.- Parameters:
values- Point at which the PDF is evaluated.- Returns:
- the value of the probability density function at point
x.
-
getComponents
public List<Pair<Double,T>> getComponents()
Gets the distributions that make up the mixture model.- Returns:
- the component distributions and associated weights.
-
createSampler
public MultivariateRealDistribution.Sampler createSampler(org.apache.commons.rng.UniformRandomProvider rng)
Creates a sampler.- Specified by:
createSamplerin interfaceMultivariateRealDistribution- Specified by:
createSamplerin classAbstractMultivariateRealDistribution- Parameters:
rng- Generator of uniformly distributed numbers.- Returns:
- a sampler that produces random numbers according this distribution.
-
-