liveBook · Manning

K-means clustering

As explained in AI-Powered Search

K-means is an unsupervised clustering algorithm that partitions items into a specified number of groups by iteratively assigning items to and updating cluster centroids.

K-means clustering partitions product or query embeddings into a configured number of groups. It learns cluster centroids, assigns items to clusters, and predicts a cluster for a new query. section 9.4.2

Mapping “microwave” to categories

K-means assigns “microwave” to cluster 44, described as a microwave stainless-steel oven category. Related cosine-based clusters include stoves, mixers, coffeemakers, and ranges.

How AI-Powered Search covers it

How deep it goes
Provides Python fitting, labeling, visualization, and prediction, then recommends related top-N cosine clusters over a single assignment.
Examples
Uses product embeddings, cluster descriptions, visualized centroids, and the “microwave” query with five related predicted categories.
What it assumes
Assumes product and query embeddings plus familiarity with cosine similarity and category-based personalization.
What you can do after
Apply it via Python and scikit-learn to generate categories and map queries to clusters for search personalization.
How it connects
Connects embeddings, cosine similarity, semantic search, personalization, and dynamic categorization.

Also explained in

Compare how 7 books explain K-means clustering →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of AI-Powered Search. The section links point to the parts of the book it draws on.