SklearnPartitioner#
- class SklearnPartitioner(clusterer)[исходный код]#
Базовые классы:
PartitionerPartitions a sample by a scikit-learn clusterer with an
n_clustersparameter.Every partition is computed by an unfitted copy of the clusterer. The copy receives
n_clusters=kand, if the clusterer has arandom_stateparameter, an integer seed drawn from the generator of the call. The object passed by the user is neither changed nor fitted. scikit-learn is an optional dependency and is required to create this partitioner (pip install pysatl-mpest[sklearn]).- Параметры:
clusterer (ClusterMixin) – Clusterer inheriting
ClusterMixinand taking the number of clusters as itsn_clustersparameter. Its values ofn_clustersandrandom_stateare replaced for every partition.- Переменные:
clusterer (ClusterMixin) – The clusterer passed by the user, unchanged.
- Исключение:
ImportError – scikit-learn is not installed.
TypeError –
clustereris not an instance ofClusterMixin, or it cannot label the points of a sample (it has nofit_predict, asFeatureAgglomeration, which clusters features).ValueError –
clustererhas non_clustersparameter.
- Предупрждения:
UserWarning – The value of
n_clustersorrandom_statediffers from the default of the clusterer constructor. The value is ignored because the partitioner sets its own value for every partition.
Заметки
Clusterers that choose the number of clusters themselves, such as
DBSCAN, are not supported. A deterministic clusterer, such asAgglomerativeClustering, gives the same partition for any generator.Methods
partition(X, k, rng)Divide the sample into
kclusters by the scikit-learn clusterer.