Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
K-Means Model with 2 Clusters | Clustering Demystified
Clustering Demystified
course content

Conteúdo do Curso

Clustering Demystified

bookK-Means Model with 2 Clusters

K-means clustering is a method of unsupervised machine learning that groups similar data points together in clusters. The algorithm starts by randomly selecting K initial centroids, where K is the number of clusters desired. Data points are then assigned to the cluster whose centroid is closest to them. The centroids are then recomputed based on the mean of all the data points in the cluster, and the process is repeated until the centroids no longer change. The result is a set of K clusters, with each data point belonging to one cluster. It is widely used for image compression, image segmentation and other applications.

Methods description

  • sklearn.cluster: This module from scikit-learn provides a variety of clustering algorithms and utilities for clustering tasks;

  • KMeans: A class representing the K-Means clustering algorithm. It partitions data into K clusters based on centroids and minimizes the within-cluster variance;

    • n_clusters: Parameter specifying the number of clusters to form;
    • random_state: Parameter controlling the random number generation for centroid initialization;
    • .fit(): Method to fit the KMeans model to the data X, where X is a feature array or sparse matrix.
Tarefa
test

Swipe to show code editor

  1. Import the KMeans module.
  2. Cluster our data into 2 clusters.

Mark tasks as Completed
Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

K-means clustering is a method of unsupervised machine learning that groups similar data points together in clusters. The algorithm starts by randomly selecting K initial centroids, where K is the number of clusters desired. Data points are then assigned to the cluster whose centroid is closest to them. The centroids are then recomputed based on the mean of all the data points in the cluster, and the process is repeated until the centroids no longer change. The result is a set of K clusters, with each data point belonging to one cluster. It is widely used for image compression, image segmentation and other applications.

Methods description

  • sklearn.cluster: This module from scikit-learn provides a variety of clustering algorithms and utilities for clustering tasks;

  • KMeans: A class representing the K-Means clustering algorithm. It partitions data into K clusters based on centroids and minimizes the within-cluster variance;

    • n_clusters: Parameter specifying the number of clusters to form;
    • random_state: Parameter controlling the random number generation for centroid initialization;
    • .fit(): Method to fit the KMeans model to the data X, where X is a feature array or sparse matrix.
Tarefa
test

Swipe to show code editor

  1. Import the KMeans module.
  2. Cluster our data into 2 clusters.

Mark tasks as Completed
Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Seção 1. Capítulo 8
AVAILABLE TO ULTIMATE ONLY
We're sorry to hear that something went wrong. What happened?
some-alt