1.1 - 8.10 - TextClassifier Example - Teradata Vantage

Teradata Vantage™ - Machine Learning Engine Analytic Function Reference

Teradata Vantage
Release Number
October 2019
Content Type
Programming Reference
Publication ID
English (United States)


id content category
16 At the beginning of 2004, Federer had a world ranking of No. 2, and that same year, he won the Australian Open, the U.S. Open, the ATP Masters and retained the Wimbledon singles title. sports
17 Federer held on to his No. 1 ranking from 2004 into 2008. In 2006 and 2007, he won the singles championships at the Australian Open, Wimbledon and the U.S. Open. sports
18 A paragon of graceful athleticism, Federer was named the Laureus World Sportsman of the Year from 2005-08. sports
19 Cyclone, tropical cyclone, hurricane, and typhoon are different names for the same phenomenon, which is a cyclonic storm system that forms over the oceans. natural disaster
20 Drought is the unusual dryness of soil, resulting in crop failure and shortage of water and for other uses which is caused by significant low rainfall than average over a prolonged period. natural disaster
21 A tornado is a violent, dangerous, rotating column of air that is in contact with both the surface of the earth and a cumulonimbus cloud or, in rare cases, the base of a cumulus cloud. natural disaster

SQL Call

SELECT * FROM TextClassifier (
  ON textclassifier_input
  TextColumn ('content')
  InputModelFile ('knn.bin')
  Accumulate ('id', 'category')
) AS dt ORDER BY id;


 id category         out_category     
 -- ---------------- ---------------- 
 16 sports           sports          
 17 sports           sports          
 18 sports           natural disaster
 19 natural disaster natural disaster
 20 natural disaster natural disaster
 21 natural disaster natural disaster

Download a zip file of all examples and a SQL script file that creates their input tables from the attachment in the left sidebar.