1.1 - 8.10 - FMeasure Example: Output All Classes - Teradata Vantage

Teradata Vantage™ - Machine Learning Engine Analytic Function Reference

Product
Teradata Vantage
Release Number
1.1
8.10
Release Date
October 2019
Content Type
Programming Reference
Publication ID
B700-4003-079K
Language
English (United States)

Input

The input table, computers_category, has five attributes of personal computers—price, speed, hard disk size, RAM, and screen size. The table has 500 rows, categorized into five price groups—SPECIAL, SUPER, HYPER, MEGA and UBER. The predicted_compcategory values can be output by a classification function, such as KNN (ML Engine).

computers_category
compid price speed hd ram screen expected_compcategory predicted_compcategory
1 1499 25 80 4 14 SPECIAL SPECIAL
2 1795 33 85 2 14 SUPER SUPER
3 1595 25 170 4 15 SPECIAL SPECIAL
4 1849 25 170 8 14 SUPER HYPER
5 3295 33 340 16 14 HYPER SUPER
6 3695 66 340 16 14 UBER SPECIAL
7 1720 25 170 4 14 SPECIAL SPECIAL
8 1995 50 85 2 14 SUPER SUPER
9 2225 50 210 8 14 SUPER SUPER
12 2605 66 210 8 14 MEGA UBER
13 2045 50 130 4 14 SUPER SUPER
14 2295 25 245 8 14 MEGA MEGA
16 2225 50 130 4 14 SUPER SUPER
... ... ... ... ... ... ... ...

SQL Call

SELECT * FROM FMeasure(
ON computers_category PARTITION BY 1
USING
ObservationColumn ('expected_compcategory')
PredictColumn ('predicted_compcategory')
Beta (1.0)
) AS dt;

Output

 class   precision          recall             beta fmeasure           
 ------- ------------------ ------------------ ---- ------------------ 
 hyper   0.9368421052631579               0.89  1.0 0.9128205128205129
 mega    0.9230769230769231  0.935064935064935  1.0 0.9290322580645162
 special            0.84375 0.8852459016393442  1.0              0.864
 super   0.9358974358974359  0.954248366013072  1.0 0.9449838187702266
 uber     0.896551724137931             0.8125  1.0 0.8524590163934426
 -AVG-                0.918              0.918  1.0              0.918

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