dtoolkit.transformer.GeoKMeans.fit_predict#

GeoKMeans.fit_predict(X, y=None, sample_weight=None)#

Compute cluster centers and predict cluster index for each sample.

Convenience method; equivalent to calling fit(X) followed by predict(X).

Parameters:
X{array-like, sparse matrix} of shape (n_samples, n_features)

New data to transform.

yIgnored

Not used, present here for API consistency by convention.

sample_weightarray-like of shape (n_samples,), default=None

The weights for each observation in X. If None, all observations are assigned equal weight.

Returns:
labelsndarray of shape (n_samples,)

Index of the cluster each sample belongs to.