Example | Fast K-Means Cluster Scoring | Vantage Analytics Library - Example - Vantage Analytics Library

Vantage Analytics Library User Guide

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
Lake
VMware
Product
Vantage Analytics Library
Release Number
2.2.0
Published
March 2023
Language
English (United States)
Last Update
2024-01-02
dita:mapPath
ibw1595473364329.ditamap
dita:ditavalPath
iup1603985291876.ditaval
dita:id
zyl1473786378775
Product Category
Teradata Vantage

This example assumes the td_analyze function is installed in a database named val_user.

The resulting model in table cust_analysis_clusters scores the customer_analysis table, producing score table cust_analysis_data.

call td_analyze (
  'kmeansscore',
  'database = val_source;
   tablename = customer_analysis;
   outputdatabase = val_results;
   outputtablename = cust_analysis_data;
   index = cust_id;
   modeldatabase = val_user;
   modeltablename = cust_analysis_clusters;
   operatordatabase = val_user;
   samplescoresize = 10;
   retain = city_name, state_code;
   clustername = mycluster;
   fallback = true;'
);

Sample of Scored Rows

Explanation of column names:
  • mycluster: Contains cluster number of users
  • cust_id: Index column
  • city_name and state_code: Retained columns
mycluster cust_id city_name state_code
2 1363413 Jacksonville FL
2 1363433 Albuquerque NM
2 1362586 Norfolk VA
2 1362855 Corpus Christi TX
2 1363053 Baltimore MD
2 1363196 Los Angeles CA
1 1363018 Phoenix AZ
3 1363167 Newark NJ
2 1363428 Indianapolis IN
2 1362876 Birmingham AL