Using the K-Means Algorithm | Teradata Vantage - k-means Algorithm Examples Using TD_KMeansPredict - Teradata VantageCloud Lake

Lake - Analyze Your Data with ClearScape Analytics™

Deployment
VantageCloud
Edition
Lake
Product
Teradata VantageCloud Lake
Release Number
Published
February 2025
ft:locale
en-US
ft:lastEdition
2026-02-20
dita:mapPath
tcl1683670667798.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
tcl1683670667798

In the following example, you have a set of unlabeled or unclustered points.

TD_KMeansPredict random points

The k-means algorithm creates clusters. The points are shown as squares and triangles with the cluster centers shown as crosses:

Then, new unlabeled data points are added to the set of points.The following image shows the new data points in circle:

To predict the label of the two new points, the k-means algorithm calculates the distances of each point from each cluster center or centroid. The k-means algorithm assigns the new point to the cluster whose centroid is closest to the new point.

In the previous image, the unknown point on the left is closer to the square cluster and the other is closer to the triangle cluster. The k-means algorithm assigns the new points to their closest cluster respectively for the calculation. The following image shows these assignments by transforming the points with their relevant figure: