partition#
- abstractmethod Partitioner.partition(X, k, rng)[исходный код]#
Divide the sample into
kclusters.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 anInitializationError.- Параметры:
X (UnivariateFloatArray) – One-dimensional sample of finite values; the caller ensures that it has at least
kpoints.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 beboolor integer; the caller converts them tofloat64.- Тип результата:
MultivariateFloatArray
- Исключение:
InitializationError – If the method itself finds the partition unlucky, for example a cluster without points. Another partition may succeed.