KMeans.fit_transform

KMeans.fit_transform(data)

Fits the estimator using the provided data and subsequently transforms the data using the fitted estimator. It simply chains calls to fit() and transform().

Parameters:

data (TypeVar(D_contra, contravariant=True)) -- The data to use for fitting and to transform. The data must have the same type as for the fit() method.

Return type:

TypeVar(R_co, covariant=True)

Returns:

The transformed data. Consult the transform() documentation for more information on the return type.