sklearn.cluster
.cluster_optics_xi¶

sklearn.cluster.
cluster_optics_xi
(reachability, predecessor, ordering, min_samples, min_cluster_size=None, xi=0.05, predecessor_correction=True)[source]¶ Automatically extract clusters according to the Xisteep method.
Parameters:  reachability : array, shape (n_samples,)
Reachability distances calculated by OPTICS (
reachability_
) predecessor : array, shape (n_samples,)
Predecessors calculated by OPTICS.
 ordering : array, shape (n_samples,)
OPTICS ordered point indices (
ordering_
) min_samples : int > 1 or float between 0 and 1
The same as the min_samples given to OPTICS. Up and down steep regions can’t have more then
min_samples
consecutive nonsteep points. Expressed as an absolute number or a fraction of the number of samples (rounded to be at least 2). min_cluster_size : int > 1 or float between 0 and 1 (default=None)
Minimum number of samples in an OPTICS cluster, expressed as an absolute number or a fraction of the number of samples (rounded to be at least 2). If
None
, the value ofmin_samples
is used instead. xi : float, between 0 and 1, optional (default=0.05)
Determines the minimum steepness on the reachability plot that constitutes a cluster boundary. For example, an upwards point in the reachability plot is defined by the ratio from one point to its successor being at most 1xi.
 predecessor_correction : bool, optional (default=True)
Correct clusters based on the calculated predecessors.
Returns:  labels : array, shape (n_samples)
The labels assigned to samples. Points which are not included in any cluster are labeled as 1.
 clusters : array, shape (n_clusters, 2)
The list of clusters in the form of
[start, end]
in each row, with all indices inclusive. The clusters are ordered according to(end, start)
(ascending) so that larger clusters encompassing smaller clusters come after such nested smaller clusters. Sincelabels
does not reflect the hierarchy, usuallylen(clusters) > np.unique(labels)
.