Skip to content
masterclass Buddy

AI & ML · Concept

k-Means

K-means clustering groups embedding vectors into a chosen number of clusters. It can reveal hidden themes in text without labeled training data.

Last updated

Syntax

KMeans(n_clusters=4, init="k-means++", random_state=42)

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • embeddings
  • vector database
  • cosine similarity
  • KMeans

Source: OpenAI API docs — full documentation. Checked 2026-11-03.