K-Means Clustering: Grouping Similar Data

How k-means groups unlabeled data: Lloyd's algorithm, k-means++, scaling, choosing k, where round clusters fail, and running it in BigQuery ML or Spark.

AI & ML

Every algorithm so far in this series has learned from labels: a known outcome for each training row. K-means has none. You hand it a table of numbers and a count, k, and it splits the rows into k groups whose members sit close together. Nobody tells it what the groups mean; you work that out afterwards by looking at them.

That makes it one of the most used tools for a question that comes up constantly in operations and analytics: what kinds of things do I actually have? Kinds of customers, kinds of support tickets, kinds of virtual machines in a fleet. This article explains how k-means finds its groups, the two settings that decide whether those groups are any good, how to pick k, and the shapes of data where it gives a confident wrong answer.

It follows naive Bayes in the series and borrows two ideas from k-nearest neighbors: distance between rows, and why features must be on a common scale. If the difference between supervised and unsupervised learning is new to you, start with supervised vs unsupervised learning.

What k-means is trying to do

Each cluster is represented by a single point, its centroid: the mean of the rows assigned to it. Every row belongs to the cluster with the nearest centroid. K-means looks for the k centroids that make the total squared distance from each row to its centroid as small as possible:

inertia = Σ over all rows of  || x - centroid(x) ||²

This number is called inertia, or the within-cluster sum of squares. Lower is tighter. Two consequences follow directly from the definition:

  • Distance is Euclidean, so a feature measured in thousands outweighs one measured in fractions. Scaling matters as much as it did for KNN.
  • Squared distance to a mean favors compact, roughly round groups of similar spread. That is the shape k-means assumes, whether or not your data has it.

Finding the centroids that give the lowest possible inertia is computationally hard in general. Every practical implementation uses a fast heuristic that finds a good answer, not a guaranteed best one.

Lloyd’s algorithm

The standard heuristic, usually called Lloyd’s algorithm, alternates between two steps until nothing changes:

flowchart TD
    S["Pick k starting centroids"] --> A["Assign each row to its nearest centroid"]
    A --> U["Move each centroid to the mean of its rows"]
    U --> C{"Did any assignment change?"}
    C -- "yes" --> A
    C -- "no" --> D["Done: k clusters and their centroids"]

Each step can only lower inertia or leave it unchanged. Assigning a row to a nearer centroid shrinks its distance, and the mean is the point that minimizes squared distance to a set of rows. Because inertia can’t fall forever, the loop always stops. It stops at a local minimum, though, which depends on where it started.

A worked example by hand

Take six machines and one feature, average CPU percent: 2, 4, 10, 30, 34 and 38. Ask for two clusters and start, deliberately badly, with centroids at 2 and 4.

IterationCentroid ACentroid BRows in ARows in B
12424, 10, 30, 34, 38
2223.22, 4, 1030, 34, 38
35.33342, 4, 1030, 34, 38

In the first pass everything except the 2 is closer to 4, so centroid B moves to the mean of five values, 23.2. In the second pass, 4 and 10 are now closer to A, so A moves to 5.33 and B to 34. The third pass changes no assignment, and the algorithm stops. Inertia is the squared distances summed: 11.11 + 1.78 + 21.78 for cluster A and 16 + 0 + 16 for cluster B, or 66.67 in total.

scikit-learn agrees when you give it the same starting centroids:

import numpy as np
from sklearn.cluster import KMeans

cpu = np.array([2, 4, 10, 30, 34, 38]).reshape(-1, 1)
km = KMeans(n_clusters=2, init=np.array([[2.0], [4.0]]), n_init=1).fit(cpu)
print("centroids:", km.cluster_centers_.ravel().round(2))
print("labels:   ", km.labels_)
print("inertia:  ", round(km.inertia_, 2))
centroids: [ 5.33 34.  ]
labels:    [0 0 0 1 1 1]
inertia:   66.67

Cluster numbers carry no meaning. Run it with a different start and the same groups might come back as 1 and 0. Any code that relies on “cluster 2 is the databases” has to map clusters to names after each training run.

Why is Lloyd's algorithm guaranteed to stop?

  • It runs for exactly k iterations
  • Neither step can increase inertia, so it settles once assignments stop changing
  • It always finds the lowest possible inertia

Correct! Reassigning rows and recomputing means each lower or keep the inertia, so the loop ends at a local minimum, not necessarily the best one.

Clustering a fleet of virtual machines

A realistic use: you run 2,000 VMs and want to know what kinds of workload they carry, for rightsizing or for choosing reserved capacity. You have four averages per VM from your monitoring system. The synthetic data below is generated from four hidden workload types, which lets you check how well k-means recovers them. Save it as fleet.py:

import numpy as np

rng = np.random.default_rng(42)

# Hidden workload types: (count, cpu %, memory %, network MB/s, disk IOPS)
profiles = {
    "idle":     (500, 4,  20,  0.5,  40),
    "web":      (700, 35, 40,  25,   300),
    "batch":    (300, 80, 55,  5,    900),
    "database": (500, 30, 85,  12,   2500),
}
rows, kinds = [], []
for kind, (n, cpu, mem, net, iops) in profiles.items():
    rows.append(np.column_stack([
        np.clip(rng.normal(cpu, cpu * 0.25 + 3, n), 0, 100),
        np.clip(rng.normal(mem, 8, n), 0, 100),
        np.abs(rng.normal(net, net * 0.4 + 1, n)),
        np.abs(rng.normal(iops, iops * 0.35, n)),
    ]))
    kinds += [kind] * n

X = np.vstack(rows)
kind = np.array(kinds)
feature_names = ["cpu_pct", "mem_pct", "net_mbps", "disk_iops"]

The kind array is for checking only; k-means never sees it. To score the match between clusters and hidden types, the code uses the adjusted Rand index (ARI), which is 1.0 for a perfect match up to renaming and close to 0 for random grouping.

Scale first

Disk IOPS runs into the thousands, while CPU and memory stay below 100. Here is k-means on the raw numbers and on standardized ones:

import pandas as pd
from sklearn.cluster import KMeans
from sklearn.metrics import adjusted_rand_score
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import StandardScaler
from fleet import X, kind

raw = KMeans(n_clusters=4, random_state=0).fit(X)
scaled = make_pipeline(StandardScaler(), KMeans(n_clusters=4, random_state=0)).fit(X)

for name, labels in [("raw", raw.labels_), ("scaled", scaled[-1].labels_)]:
    print(f"{name}: ARI={adjusted_rand_score(kind, labels):.3f}")
    print(pd.crosstab(kind, labels, rownames=["kind"], colnames=["cluster"]), "\n")
raw: ARI=0.423
cluster     0    1    2    3
kind
batch      58    0  236    6
database   11  164   85  240
idle      500    0    0    0
web       699    0    1    0

scaled: ARI=0.892
cluster     0    1    2    3
kind
batch       3    1    4  292
database    5  487    0    8
idle        0    0  500    0
web       639    0   36   25

On raw values, k-means spends its four clusters on IOPS alone. Idle and web machines, which differ by tens of percent in CPU but only by a few hundred IOPS, land in one cluster of 1,199. The databases, with the widest IOPS range, are cut into three bands. Nothing is wrong with the algorithm; it minimized squared distance in units where one feature dominates.

After standardizing each feature to mean 0 and standard deviation 1, the four clusters line up with the four workload types, and the ARI rises from 0.42 to 0.89. The remaining errors are mostly busy web servers that drift toward the batch or idle groups. Put the scaler and the model in one pipeline, as above, so new data is scaled with the same means and deviations.

Standardizing gives every feature equal say. That is a choice, not a law: if memory matters more than network for your rightsizing question, you can multiply its scaled column by a weight. Features that carry no information about the grouping you care about still add distance noise, exactly as they did for KNN, so leave them out rather than hoping they average away.

Read the clusters back in real units

The centroids are the model’s summary of each group. Transform them back to the original units and they read like a description of the fleet:

import numpy as np
import pandas as pd
from sklearn.cluster import KMeans
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import StandardScaler
from fleet import X, feature_names

model = make_pipeline(StandardScaler(), KMeans(n_clusters=4, random_state=0)).fit(X)
centroids = model[0].inverse_transform(model[-1].cluster_centers_)
summary = pd.DataFrame(centroids, columns=feature_names).round(1)
summary["vms"] = np.bincount(model[-1].labels_)
print(summary)
   cpu_pct  mem_pct  net_mbps  disk_iops  vms
0     35.0     40.4      26.7      302.7  647
1     30.3     84.9      12.0     2485.2  488
2      6.0     21.2       1.5       61.8  540
3     74.1     55.3       5.3      888.2  325

Cluster 2 is 540 machines averaging 6 percent CPU: candidates for smaller instance types or shutdown. Cluster 1 is memory-heavy and IO-heavy, which points at memory-optimized types with faster disks. This is the real output of a clustering project: not the labels, but a short table a person can act on. The utilization averages themselves come from your provider’s monitoring service, such as CloudWatch, Azure Monitor or Cloud Monitoring.

Choosing k

K-means does not find k for you. Inertia always falls as k grows, reaching zero when every row is its own cluster, so you can’t simply minimize it. Two common checks:

  • Elbow method. Plot inertia against k and look for the point where adding a cluster stops buying much.
  • Silhouette score. For each row, compare the mean distance to rows in its own cluster (a) with the mean distance to rows in the nearest other cluster (b). The silhouette is (b - a) / max(a, b), from -1 to 1, averaged over all rows. Higher means tighter, better separated clusters.
from sklearn.cluster import KMeans
from sklearn.metrics import silhouette_score
from sklearn.preprocessing import StandardScaler
from fleet import X

Xs = StandardScaler().fit_transform(X)
for k in range(2, 9):
    km = KMeans(n_clusters=k, random_state=0).fit(Xs)
    print(f"k={k}  inertia={km.inertia_:7.1f}  silhouette={silhouette_score(Xs, km.labels_):.3f}")
k=2  inertia= 4809.2  silhouette=0.409
k=3  inertia= 2938.2  silhouette=0.484
k=4  inertia= 1602.3  silhouette=0.567
k=5  inertia= 1391.9  silhouette=0.509
k=6  inertia= 1082.1  silhouette=0.458
k=7  inertia=  956.1  silhouette=0.435
k=8  inertia=  875.9  silhouette=0.412

Going from three to four clusters cuts inertia by about 1,300; going from four to five cuts it by about 210. The silhouette peaks at four as well. Both checks point at the true number of workload types here, which is the easy case. On real data the elbow is often a gentle curve, and the silhouette may peak at 2 because one big split dominates.

When the numbers disagree or say little, decide k from the use. If the clusters feed a rightsizing review, four to eight groups a person can read beat a statistically neater 23. Silhouette also costs time proportional to the square of the row count, so on large data compute it on a sample: silhouette_score takes a sample_size argument.

Why can't you choose k by picking the value with the lowest inertia?

  • Inertia keeps falling as k grows, reaching zero when every row is its own cluster
  • Inertia is only defined for k equal to 2
  • Inertia ignores the distance between rows and centroids

Correct! More clusters always fit tighter, so you look for where extra clusters stop helping, or use a measure like silhouette that also rewards separation.

Starting points: k-means++ and n_init

Lloyd’s algorithm only finds a local minimum, and which one depends on the starting centroids. Two random starts placed in the same true group will often stay there, leaving another true group split or merged.

k-means++ chooses starting centroids that are spread out. The first is a random row. Each following one is drawn at random with probability proportional to its squared distance from the nearest centroid already chosen, so far-away rows are likely picks. It is the default init in scikit-learn.

The other defence is to run the whole algorithm several times from different starts and keep the result with the lowest inertia. That is n_init. Since scikit-learn 1.4 its default is "auto", which means one run with k-means++ and ten runs with random initialization.

To see the effect, take 3,000 points in 15 well-separated groups and fit each configuration with 100 different seeds:

import numpy as np
from sklearn.cluster import KMeans
from sklearn.datasets import make_blobs

X, _ = make_blobs(n_samples=3000, centers=15, cluster_std=0.6,
                  center_box=(-20, 20), random_state=3)
best = KMeans(n_clusters=15, n_init=50, random_state=0).fit(X).inertia_

for init, n_init in [("random", 1), ("random", 10), ("k-means++", 1), ("k-means++", 10)]:
    runs = np.array([
        KMeans(n_clusters=15, init=init, n_init=n_init, random_state=seed).fit(X).inertia_
        for seed in range(100)
    ])
    print(f"{init:<10} n_init={n_init:<2}  found best: {np.mean(runs <= best * 1.001):4.0%}  "
          f"median inertia vs best: {np.median(runs / best):.2f}x")
random     n_init=1   found best:   1%  median inertia vs best: 5.57x
random     n_init=10  found best:   2%  median inertia vs best: 1.45x
k-means++  n_init=1   found best:  14%  median inertia vs best: 1.06x
k-means++  n_init=10  found best:  96%  median inertia vs best: 1.00x

With 15 groups, random starts almost never land one centroid in each group, and ten of them still leave the median result 45 percent worse than the best. A single k-means++ start is close, and ten of them find the best solution 96 times out of 100. With few clusters, as in the fleet example, the default single run is usually fine. With many clusters, or if a rerun gives noticeably different groups, set n_init to 10 or more. The extra runs cost time in proportion, and k-means is fast enough that this rarely matters.

Where k-means fails

K-means draws the boundary between two clusters halfway between their centroids, as a straight line in two dimensions or a flat plane in more. Every region it carves out is convex. That fits compact, similar-sized blobs and fails on three common shapes:

  • Non-convex groups, such as two interleaved crescents.
  • Stretched groups, where a cluster is long in one direction and thin in another.
  • Groups of very different size and spread, where the boundary halfway between centroids cuts through the edge of the big, loose group.

Here are the three shapes, with two alternatives. A Gaussian mixture model (GMM) fits each cluster as an ellipse with its own size and orientation. DBSCAN grows clusters from dense regions and marks sparse points as noise, with no k at all.

import numpy as np
from sklearn.cluster import DBSCAN, KMeans
from sklearn.datasets import make_blobs, make_moons
from sklearn.metrics import adjusted_rand_score
from sklearn.mixture import GaussianMixture
from sklearn.preprocessing import StandardScaler

moons = make_moons(1000, noise=0.06, random_state=0)
Xa, ya = make_blobs(1500, centers=3, random_state=170)
stretched = (Xa @ np.array([[0.6, -0.64], [-0.41, 0.85]]), ya)
unequal = make_blobs(n_samples=[1000, 100, 100], centers=[[0, 0], [4.5, 0], [0, 4.5]],
                     cluster_std=[1.5, 0.3, 0.3], random_state=0)

for name, (X, y) in [("moons", moons), ("stretched", stretched), ("unequal", unequal)]:
    X = StandardScaler().fit_transform(X)
    k = len(np.unique(y))
    labels = {
        "k-means": KMeans(n_clusters=k, random_state=0).fit_predict(X),
        "GMM": GaussianMixture(n_components=k, n_init=5, random_state=0).fit(X).predict(X),
        "DBSCAN": DBSCAN(eps=0.2, min_samples=10).fit_predict(X),
    }
    print(f"{name:<10}", "  ".join(f"{m}={adjusted_rand_score(y, l):.3f}" for m, l in labels.items()))
moons      k-means=0.506  GMM=0.515  DBSCAN=0.998
stretched  k-means=0.597  GMM=1.000  DBSCAN=0.976
unequal    k-means=0.206  GMM=0.974  DBSCAN=0.514

Each method wins where its assumption holds. The mixture model recovers stretched and unequal clusters almost perfectly because it can fit ellipses of different sizes, but it still assumes ellipses, so the crescents defeat it. DBSCAN follows the crescents but needs a density threshold, eps, that suits every cluster at once; on the unequal data no single value does. k-means returns four clean-looking groups in every case, which is the danger. It never reports that the data doesn’t suit it. Look at the clusters, through centroid tables, a 2D projection with principal component analysis (the next article in this series), or a sample of rows per cluster, before you trust them.

flowchart TD
    Q["Need to group unlabeled rows"] --> R{"Roughly round groups of similar spread?"}
    R -- "yes" --> K["k-means"]
    R -- "no" --> E{"Elliptical, or different sizes?"}
    E -- "yes" --> G["Gaussian mixture"]
    E -- "no" --> D{"Arbitrary shapes and noise points?"}
    D -- "yes" --> B["DBSCAN or HDBSCAN"]
    D -- "no" --> H["Hierarchical clustering to explore"]

On data shaped as two interleaved crescents, what does k-means with k=2 do?

  • Raises an error because the clusters are not convex
  • Finds the two crescents, but more slowly
  • Returns two tidy-looking clusters that each cut across both crescents

Correct! k-means always produces k convex regions and gives no warning when the real groups have another shape.

Using a fitted model

Once trained, k-means is a lookup: compute the distance from a new row to each centroid and take the nearest. In scikit-learn, predict returns the cluster and transform returns the distance to every centroid.

That distance is useful by itself. A row far from every centroid matches none of the known groups, which makes it a simple anomaly score:

import numpy as np
from sklearn.cluster import KMeans
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import StandardScaler
from fleet import X

model = make_pipeline(StandardScaler(), KMeans(n_clusters=4, random_state=0)).fit(X)
train_dist = model.transform(X).min(axis=1)       # distance to the nearest centroid
print("training distances: median={:.2f}  p99={:.2f}  max={:.2f}".format(
    np.median(train_dist), np.percentile(train_dist, 99), train_dist.max()))

new_vms = np.array([
    [40, 42, 22, 280],    # looks like a web server
    [85, 95, 4, 3000],    # a database under heavy load
    [3, 15, 90, 50],      # nearly idle, but sending 90 MB/s
])
for vm, cluster, dist in zip(new_vms, model.predict(new_vms), model.transform(new_vms).min(axis=1)):
    print(f"{vm.tolist()} -> cluster {cluster}, distance {dist:.2f}")
training distances: median=0.72  p99=2.04  max=2.65
[40, 42, 22, 280] -> cluster 0, distance 0.44
[85, 95, 4, 3000] -> cluster 1, distance 2.38
[3, 15, 90, 50] -> cluster 0, distance 5.51

All three new machines get a cluster, because predict always picks one. The distances tell them apart. The first is a typical web server. The second is a busy database, beyond the 99th percentile of training distances but within the range seen. The third is twice as far as any training machine: a nearly idle VM sending 90 MB/s matches no workload type in the fleet and deserves a look. A threshold at the 99th or 99.9th percentile of training distances is a reasonable starting alert.

Large and streaming data

Each Lloyd iteration touches every row, so on very large tables the cost is in reading the data, not in the arithmetic. MiniBatchKMeans updates the centroids from small random batches instead, and supports partial_fit, so you can train from data that arrives in chunks or doesn’t fit in memory:

import numpy as np
from sklearn.cluster import MiniBatchKMeans
from sklearn.metrics import adjusted_rand_score
from sklearn.preprocessing import StandardScaler
from fleet import X, kind

scaler = StandardScaler().fit(X)          # in production, fit on a sample or keep running stats
mbk = MiniBatchKMeans(n_clusters=4, n_init=3, random_state=0)
order = np.random.default_rng(1).permutation(len(X))
for start in range(0, len(X), 500):
    mbk.partial_fit(scaler.transform(X[order[start:start + 500]]))

Xs = scaler.transform(X)
print(f"ARI={adjusted_rand_score(kind, mbk.predict(Xs)):.3f}  inertia={-mbk.score(Xs):.1f}")
ARI=0.851  inertia=1630.3

Four batches of 500 reach an inertia within 2 percent of full k-means (1,602) and an ARI of 0.85 against 0.89. That is the usual trade: slightly worse clusters for bounded memory and the ability to keep learning. On data that fits in memory, plain KMeans is often just as fast, so reach for the mini-batch version when memory or streaming is the constraint.

K-means in the cloud

For data that already lives in a warehouse or lake, the managed options save you moving it.

BigQuery ML trains k-means with SQL. STANDARDIZE_FEATURES defaults to TRUE, so the scaling step is built in, and KMEANS_INIT_METHOD accepts RANDOM, KMEANS++ or CUSTOM:

CREATE OR REPLACE MODEL ops.vm_workloads
OPTIONS (
  model_type = 'KMEANS',
  num_clusters = 4,
  kmeans_init_method = 'KMEANS++'
) AS
SELECT cpu_pct, mem_pct, net_mbps, disk_iops
FROM ops.vm_daily_averages;

SELECT vm_id, CENTROID_ID, NEAREST_CENTROIDS_DISTANCE
FROM ML.PREDICT(MODEL ops.vm_workloads, TABLE ops.vm_daily_averages);

ML.PREDICT returns the cluster and the distances to the nearest centroids, the same anomaly signal as above, and ML.CENTROIDS returns the centroid table. Columns not used as features, such as vm_id, pass through to the output.

Apache Spark has pyspark.ml.clustering.KMeans for distributed training on Amazon EMR, Google Cloud Dataproc, Azure Databricks or any Spark service. Its defaults differ from scikit-learn’s: k=2, maxIter=20, and initMode="k-means||", a parallel version of k-means++ that picks starting centroids in a few passes over distributed data. Spark does not scale features for you, so put a StandardScaler stage in the pipeline:

from pyspark.ml import Pipeline
from pyspark.ml.clustering import KMeans
from pyspark.ml.feature import StandardScaler, VectorAssembler

pipeline = Pipeline(stages=[
    VectorAssembler(inputCols=["cpu_pct", "mem_pct", "net_mbps", "disk_iops"], outputCol="raw"),
    StandardScaler(inputCol="raw", outputCol="features", withMean=True, withStd=True),
    KMeans(k=4, seed=0, featuresCol="features"),
])
model = pipeline.fit(vm_df)          # a DataFrame with the four metric columns
clustered = model.transform(vm_df)   # adds a "prediction" column

Amazon SageMaker AI offers k-means as a built-in algorithm. It uses a web-scale mini-batch variant, requires the feature_dim and k hyperparameters, and can use k-means++ initialization through init_method. It suits the case where your data is in S3 and you want a managed training job and endpoint rather than a notebook.

For a small table, none of this is necessary: the scikit-learn pipeline runs in seconds on a laptop or in the simple ML project setup.

For further reading, see the scikit-learn clustering guide, the BigQuery ML k-means CREATE MODEL reference, the Spark KMeans API and the SageMaker k-means hyperparameters.

K-means compared with other clustering methods

k-meansMini-batch k-meansGaussian mixtureDBSCANHierarchical
You choosekk, batch sizeNumber of componentseps, min_samplesWhere to cut the tree
Cluster shapeRound, similar sizeRound, similar sizeEllipses of any sizeAny shapeDepends on linkage
Noise pointsAssigned to a clusterAssigned to a clusterLow probabilityLabeled as noiseAssigned to a cluster
AssignmentHardHardSoft probabilitiesHardHard
Cost on large dataLowLowest, bounded memoryModerateModerateHigh, memory grows with rows squared
New rowspredictpredict, partial_fitpredict_probaRefitRefit

When to use k-means

K-means is a good choice when:

  • you want a quick, readable segmentation of numeric data, such as workloads, customers or usage patterns
  • the groups you expect are compact and of broadly similar spread
  • you need to assign new rows cheaply and consistently after training
  • you want a simple distance-based anomaly score or to compress data into k representative points

Look elsewhere when the groups have irregular shapes or very different densities (DBSCAN or HDBSCAN), when clusters overlap and you need membership probabilities (a Gaussian mixture), when most features are categorical (k-modes or a distance designed for categories), or when you have labels for the thing you actually want to predict, in which case a supervised model such as a random forest will serve you better.

Key takeaways

  • K-means splits unlabeled rows into k groups by minimizing the total squared distance from each row to its cluster’s mean, alternating between assigning rows and moving centroids until nothing changes.
  • It always converges, but to a local minimum. k-means++ starts and several runs through n_init make a good solution far more likely, especially with many clusters.
  • Scale your features. On the fleet data, standardizing raised the match with the true workload types from an ARI of 0.42 to 0.89.
  • Choose k with the elbow and silhouette checks, then with the use the clusters will serve. Both checks are guides, not answers.
  • K-means assumes compact, round, similar-sized clusters and never warns you when the data disagrees. Inspect the clusters, and try a Gaussian mixture or DBSCAN when the shapes don’t fit.
  • Distance to the nearest centroid doubles as an anomaly score, and BigQuery ML, Spark and SageMaker AI run the same algorithm where your data already lives.

Part 8 of 8 · Machine Learning Algorithms

  1. 01Linear Regression: Predicting Outcomes
  2. 02Logistic Regression: Understanding Probabilities
  3. 03Decision Trees: Making Decisions Using Data
  4. 04Random Forest: An Ensemble Learning Method
  5. 05Support Vector Machines: Classifying Data
  6. 06K-Nearest Neighbors: Finding Similar Data Points
  7. 07Naive Bayes: Applying Probability in ML
  8. 08K-Means Clustering: Grouping Similar Data
Ready to check your understanding?Take the Artificial Unintelligence quiz
esc

Type to search all articles · ↑↓ to move · ↵ to open