# Inertia

*noun*

say it: **“ih-NUR-shuh”** **/ɪˈnɝʃə/**

In k-means, the total of the squared distances from each example to its group's center, used to measure how tight the groups are.

## What is **inertia** in k-means?

**Inertia** adds up each example's squared distance to its cluster's center: the lower it is, the tighter the
clusters. It always drops as you add clusters, reaching 0 when every example is its own cluster, so you look for where
it stops dropping much. scikit-learn's `KMeans` keeps it in `inertia_`.

```python
from sklearn.cluster import KMeans
visits = [[1, 30], [2, 28], [1, 32], [6, 5], [7, 6], [6, 4]]   # visits a week, dollars a visit
for k in (1, 2, 3):
    print(k, round(KMeans(n_clusters=k, random_state=0).fit(visits).inertia_, 1))
# 1 986.3
# 2 11.3     a big drop: two real groups
# 3 4.7
```

## In a sentence

- “Lower **inertia** alone can't choose k, because it always drops as k grows.”
- “The **inertia** fell sharply from one cluster to two, then barely moved.”

Level: Freelancer · [More AI Basics terms at this level](https://www.ask-codey.com/glossary?category=ai&level=4)

Updated: November 19, 2026

Source: https://www.ask-codey.com/glossary/inertia
