Scikit-learn

Scikit-learn k-Means

Create K-Means clustering model for unsupervised learning. This algorithm partitions the data into a predefined number of clusters (k), where each data point belongs to the cluster with the nearest mean (centroid). The performance of the K-Means model depends on the number of clusters k and the initialization of the centroids. After model creation, please fit it with the data.

k-means

Required packages

You need below packages to use the code generated by recipe. All packages are automatically installed in MLJAR Studio.

scikit-learn>=1.5.0

Interactive recipe

You can use below interactive recipe to generate code. This recipe is available in MLJAR Studio.

Python code

# Python code will be here

Code explanation

Create a K-Means model for clustering, which partitions data into k clusters. Fit the model with the data afterward.

« Previous
Calibration Plot
Next »
LightGBM