TD_Silhouette Example | Silhouette | Teradata Vantage - Example: How to Use TD_Silhouette - 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

TD_Silhouette InputTable

 id clusterid c1 c2 
 -- --------- -- -- 
  1         1  1  1
  2         1  2  2
  3         2  8  8
  4         2  9  9

Example: TD_Silhouette Call Using SCORE

SELECT * FROM TD_Silhouette(
ON input_tbl as InputTable
USING
 IdColumn('id')
 ClusterIdColumn('clusterid')
 TargetColumns('c1','c2')
 OutputType('SCORE')
) as dt;

TD_Silhouette Output Using SCORE

silhouette_score 
---------------- 
     0.856410256

Example: TD_Silhouette Call Using SAMPLE_SCORES

SELECT * FROM TD_Silhouette(
ON input_tbl as InputTable
USING
 IdColumn('id')
 ClusterIdColumn('clusterid')
 TargetColumns('c1','c2')
 OutputType('SAMPLE_SCORES')
) as dt;

TD_Silhouette Output Using SAMPLE_SCORES

id clusterid a_i         b_i          silhouette_score 
-- --------- ----------- ------------ ---------------- 
 1         1 1.414213562 10.606601718      0.866666667
 4         2 1.414213562 10.606601718      0.866666667
 3         2 1.414213562  9.192388155      0.846153846
 2         1 1.414213562  9.192388155      0.846153846

Example: TD_Silhouette Call Using CLUSTER_SCORES

Output when OutputType is set to CLUSTER_SCORES.

SELECT * FROM TD_Silhouette(
ON input_tbl as InputTable
USING
 IdColumn('id')
 ClusterIdColumn('clusterid')
 TargetColumns('c1','c2')
 OutputType('CLUSTER_SCORES')
) as dt;

TD_Silhouette Output Using CLUSTER_SCORES

clusterid silhouette_score 
--------- ---------------- 
        1      0.856410256
        2      0.856410256

Example: TD_Silhouette Using TargetColumns and SCORE

SELECT * FROM TD_Silhouette(
ON input_tbl as InputTable
USING
 IdColumn('id')
 ClusterIdColumn('clusterid')
 TargetColumns('[2:3]')
 OutputType('SCORE')
) as dt;