Using the K-Means Algorithm | Teradata Vantage - Example: How to Use the k-means Algorithm - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
ft:locale
en-US
ft:lastEdition
2024-12-11
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905

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: