Every new sample is inserted into the root of the Clustering Feature
Tree. It is then clubbed together with the subcluster that has the
centroid closest to the new sample. This is done recursively till it
ends up at the subcluster of the leaf of the tree has the closest centroid.

The radius of the subcluster obtained by merging a new sample and the
closest subcluster should be lesser than the threshold. Otherwise a new
subcluster is started.

branching_factor : int, default 50

Maximum number of CF subclusters in each node. If a new samples enters
such that the number of subclusters exceed the branching_factor then
the node has to be split. The corresponding parent also has to be
split and if the number of subclusters in the parent is greater than
the branching factor, then it has to be split recursively.

n_clusters : int, instance of sklearn.cluster model, default None

Number of clusters after the final clustering step, which treats the
subclusters from the leaves as new samples. By default, this final
clustering step is not performed and the subclusters are returned
as they are. If a model is provided, the model is fit treating
the subclusters as new samples and the initial data is mapped to the
label of the closest subcluster. If an int is provided, the model
fit is AgglomerativeClustering with n_clusters set to the int.

compute_labels : bool, default True

Whether or not to compute labels for each fit.

copy : bool, default True

Whether or not to make a copy of the given data. If set to False,
the initial data will be overwritten.

Attributes:

root_ : _CFNode

Root of the CFTree.

dummy_leaf_ : _CFNode

Start pointer to all the leaves.

subcluster_centers_ : ndarray,

Centroids of all subclusters read directly from the leaves.

subcluster_labels_ : ndarray,

Labels assigned to the centroids of the subclusters after
they are clustered globally.

labels_ : ndarray, shape (n_samples,)

Array of labels assigned to the input data.
if partial_fit is used instead of fit, they are assigned to the
last batch of data.

The method works on simple estimators as well as on nested objects
(such as pipelines). The former have parameters of the form
<component>__<parameter> so that it’s possible to update each
component of a nested object.