1.1 - 8.10 - XGBoostPredict Example: Binary Classification - 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

InputTable: housing_test_binary
sn price lotsize bedrooms bathrms stories driveway recroom fullbase gashw airco garagepl prefarea homestyle
13 27000 1700 3 1 2 yes no no no no 0 no Classic
16 37900 3185 2 1 1 yes no no no yes 0 no Classic
540 85000 7320 4 2 2 yes no no no no 0 no Eclectic
... ... ... ... ... ... ... ... ... ... ... ... ... ...

SQL Call

CREATE MULTISET TABLE housing_predict AS (
  SELECT * FROM XGBoostPredict (
    ON housing_test_binary AS InputTable PARTITION BY ANY
    ON xgboost_model AS ModelTable DIMENSION ORDER BY tree_id, iter, class_num
    USING
    IDColumn ('sn')
    NumBoostedTrees (1)
    Accumulate ('homestyle')
  ) AS dt
) WITH DATA;
 

Output

SELECT * FROM housing_predict ORDER BY 1;
 sn  homestyle prediction confidence_lower confidence_upper 
 --- --------- ---------- ---------------- ---------------- 
  13 classic   classic                 1.0              1.0
  16 classic   classic                 1.0              1.0
  25 classic   classic                 1.0              1.0
  38 eclectic  eclectic                1.0              1.0
  53 eclectic  eclectic                1.0              1.0
 111 classic   classic                 1.0              1.0
 117 eclectic  eclectic                1.0              1.0
 132 classic   classic                 1.0              1.0
 140 classic   classic                 1.0              1.0
 142 classic   classic                 1.0              1.0
 157 eclectic  eclectic                1.0              1.0
 161 eclectic  eclectic                1.0              1.0
 176 eclectic  eclectic                1.0              1.0
 177 eclectic  eclectic                1.0              1.0
 195 classic   classic                 1.0              1.0
 198 classic   classic                 1.0              1.0
 224 eclectic  eclectic                1.0              1.0
 234 classic   classic                 1.0              1.0
 237 classic   classic                 1.0              1.0
 239 classic   classic                 1.0              1.0
 249 classic   classic                 1.0              1.0
 251 classic   classic                 1.0              1.0
 254 eclectic  eclectic                1.0              1.0
 255 eclectic  eclectic                1.0              1.0
 260 classic   classic                 1.0              1.0
 274 eclectic  eclectic                1.0              1.0
 294 classic   classic                 1.0              1.0
 301 eclectic  eclectic                1.0              1.0
 306 eclectic  eclectic                1.0              1.0
 317 eclectic  eclectic                1.0              1.0
 340 eclectic  eclectic                1.0              1.0
 353 eclectic  eclectic                1.0              1.0
 355 eclectic  eclectic                1.0              1.0
 364 eclectic  eclectic                1.0              1.0
 401 eclectic  eclectic                1.0              1.0
 403 eclectic  eclectic                1.0              1.0
 408 eclectic  eclectic                1.0              1.0
 411 eclectic  eclectic                1.0              1.0
 440 eclectic  eclectic                1.0              1.0
 441 eclectic  eclectic                1.0              1.0
 443 eclectic  eclectic                1.0              1.0
 459 classic   classic                 1.0              1.0
 463 classic   classic                 1.0              1.0
 469 eclectic  eclectic                1.0              1.0
 472 eclectic  eclectic                1.0              1.0
 540 eclectic  eclectic                1.0              1.0

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