partition#

abstractmethod Partitioner.partition(X, k, rng)[исходный код]#

Divide the sample into k clusters.

The order of the columns is arbitrary: the number of a cluster means nothing until a matcher assigns the cluster to a family. The caller checks the structure of the result: a wrong structure is a ValueError, an empty cluster an InitializationError.

Параметры:
  • X (UnivariateFloatArray) – One-dimensional sample of finite values; the caller ensures that it has at least k points.

  • k (int) – Number of clusters.

  • rng (numpy.random.Generator) – The only source of randomness of the method.

Результат:

Matrix of shape (n, k) with exactly one 1 in every row, in the column of the cluster of that point. Its elements may also be bool or integer; the caller converts them to float64.

Тип результата:

MultivariateFloatArray

Исключение:

InitializationError – If the method itself finds the partition unlucky, for example a cluster without points. Another partition may succeed.