pysatl_mpest.initializers#
Initializers build a starting MixtureModel from a sample and a list of component families.
The package exports the base Initializer, the cluster initializer
ClusterInitializer with its role contracts Partitioner, ComponentEstimator and
Matcher and the protocol ComponentTable, the errors, the partitioning methods
KMeansPartitioner, QuantilePartitioner, RandomCentersPartitioner and
SklearnPartitioner, the component estimators MLEComponentEstimator and
MomentsComponentEstimator, and the matchers HungarianMatcher and IdentityMatcher.
SklearnPartitioner needs scikit-learn, an optional dependency installed with
pip install pysatl-mpest[sklearn]; the rest of the package works without it. The wrapper
MultiStartInitializer repeats another initializer and keeps the best start, and
RefiningInitializer improves a start with a mixture estimator of pysatl_mpest.estimators, the only
dependency of the package on the estimators. The facade MultiStartRefiningInitializer combines both:
every run of the multistart refines its start with the estimator.
Initializers#
Builds a starting mixture by clustering the sample and estimating one component per cluster. |
|
Runs another initializer several times and returns the start with the largest log-likelihood. |
|
Refines the start of another initializer with a mixture estimator. |
|
Runs several starts refined by an estimator and returns the refinement with the largest log-likelihood. |
Abstract Classes#
Builds a starting |
|
Divides a sample into |
|
Estimates the free parameters of one component from the points of a cluster. |
|
Decides which cluster is assigned to which distribution family. |
|
Everything a matcher may ask about the components estimated for pairs of a family and a cluster. |
Partitioners#
Partitions a sample by one run of k-means with k-means++ initial centers. |
|
Divides the sorted sample into consecutive segments with equal numbers of points. |
|
Draws centers from the distinct values of the sample and assigns points to the nearest center. |
|
Partitions a sample by a scikit-learn clusterer with an |
Component Estimators#
Estimates the free parameters of a component by closed-form maximum likelihood formulas, without optimization. |
|
Estimates the free parameters of a component by the method of moments, without optimization. |
Matchers#
Matches clusters to families by the maximum sum of the pair log-likelihoods. |
|
Assigns every family the cluster with the same index. |
Exceptions#
An initializer could not build a starting mixture from this partition of the sample. |
|
The parameters of a component cannot be estimated from a cluster. |