ClusterInitializer#
- class ClusterInitializer(partitioner, *, component_estimator=None, matcher=None, min_cluster_size=None)[исходный код]#
Базовые классы:
InitializerBuilds a starting mixture by clustering the sample and estimating one component per cluster.
The initializer performs five steps: it checks the input, partitions the sample into as many clusters as there are families, creates a lazy component table, matches clusters to families and assembles the mixture. The partitioning method is required; the component estimator and the matcher are optional and default to new
MLEComponentEstimatorandHungarianMatcherobjects for every initializer.min_cluster_sizeprotects the estimation from clusters that are too small. By default it is twice the largest number of free parameters among the families; the value1turns the check into requiring only non-empty clusters. All randomness comes from the generator passed byinitialize(). The initializer has no state: every call creates a new component table and does not modify the roles or the threshold.- Параметры:
partitioner (Partitioner) – Method that divides the sample into clusters.
component_estimator (ComponentEstimator | None, optional) – Estimator of the free parameters of one component.
Nonecreates a newMLEComponentEstimator.matcher (Matcher | None, optional) – Matcher of clusters to families.
Nonecreates a newHungarianMatcher.min_cluster_size (int | numpy.integer | None, optional) – Smallest allowed number of points in a cluster.
Noneuses twice the largest number of free parameters among the families on every call.
- Переменные:
partitioner (Partitioner) – The partitioning method, the same object that was passed to the constructor.
component_estimator (ComponentEstimator) – The component estimator, the passed object or the created default one.
matcher (Matcher) – The matcher, the passed object or the created default one.
min_cluster_size (int | None) – The explicit cluster size threshold as
int, orNonewhen the default is computed per call.
- Исключение:
TypeError – If a role is not an instance of the base class of that role.
ValueError – If
min_cluster_sizeis not a positive integer orNone.
Methods
initialize(X, families[, random_state])Build a starting mixture from the sample.