ClusterInitializer#

class ClusterInitializer(partitioner, *, component_estimator=None, matcher=None, min_cluster_size=None)[исходный код]#

Базовые классы: Initializer

Builds 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 MLEComponentEstimator and HungarianMatcher objects for every initializer.

min_cluster_size protects the estimation from clusters that are too small. By default it is twice the largest number of free parameters among the families; the value 1 turns the check into requiring only non-empty clusters. All randomness comes from the generator passed by initialize(). 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. None creates a new MLEComponentEstimator.

  • matcher (Matcher | None, optional) – Matcher of clusters to families. None creates a new HungarianMatcher.

  • min_cluster_size (int | numpy.integer | None, optional) – Smallest allowed number of points in a cluster. None uses 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, or None when 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_size is not a positive integer or None.

Methods

initialize(X, families[, random_state])

Build a starting mixture from the sample.