ROC Example: OutputTable, Default Value | Teradata Vantage - ROC Example: OutputTable, Default Values - Teradata Vantage

Machine Learning Engine Analytic Function Reference

Product
Teradata Vantage
Release Number
9.02
9.01
2.0
1.3
Published
February 2022
Language
English (United States)
Last Update
2022-02-10
dita:mapPath
rnn1580259159235.ditamap
dita:ditavalPath
ybt1582220416951.ditaval
dita:id
B700-4003
lifecycle
previous
Product Category
Teradata Vantageā„¢

Input

model_id id  observation  probability          
 -------- --- ----------- ------------
        1   7 0           0.15
        1  40 0           0.4
        1  55 1           1.0
        1  57 1           0.85
        1  72 1           1.0
        1  80 1           0.9
        1  95 1           1.0
        1 110 0           0.0
        1 112 0           0.0
        1 118 0           0.0
        1 120 1           0.9
        1 127 0           0.0
        1 135 0           0.0
        1 150 0           0.1
        1 158 1           1.0
        1 162 0           0.05
        1 167 0           0.0
        1 173 0           0.0
        1 175 0           0.0
        1 190 1           0.9
        1 200 0           0.0
        1 213 1           0.1
        1 217 0           0.0
        1 223 1           1.0
        1 228 0           0.0
        2 230 0           0.05
        2 240 0           0.0
        2 255 0           0.0
        2 268 1           1.0
        2 270 1           1.0
        2 272 1           1.0
        2 278 1           0.9
        2 295 1           1.0
        2 310 1           0.9
        2 343 0           0.0
        2 345 0           0.05
        2 360 0           0.15
        2 383 1           1.0
        2 398 0           0.3
        2 400 1           0.95
        2 406 0           0.0
        2 415 0           0.0
        2 423 0           0.0
        2 438 0           0.0
        2 446 1           1.0
        2 453 0           0.0
        2 455 0           0.05
        2 461 0           0.1
        2 463 0           0.0
        2 478 1           0.85
        3 488 1           0.75
        3 493 1           1.0
        3 501 1           1.0
        3 503 0           0.4
        3 505 0           0.35
        3 516 0           0.0
        3 518 0           0.0
        3 528 0           0.15
        3 533 1           0.9
        3 543 1           0.7
        3 556 1           0.7
        3 558 1           1.0
        3 560 1           0.95
        3 575 1           0.35
        3 583 0           0.0
        3 598 1           1.0
        3 615 1           0.45
        3 631 1           1.0
        3 648 1           0.9
        3 671 0           0.05
        3 686 0           0.0
        3 688 0           0.1
        3 703 0           0.0
        3 711 0           0.8
        3 718 0           0.15
        4 726 1           1.0
        4 734 0           0.05
        4 741 1           0.4
        4 743 0           0.05
        4 749 0           0.0
        4 751 0           0.0
        4 758 0           0.0
        4 766 1           0.85
        4 781 0           0.7
        4 789 0           0.1
        4 791 1           0.7
        4 793 1           1.0
        4 798 0           0.0
        4 804 1           1.0
        4 806 0           0.0
        4 808 1           0.9
        4 821 1           1.0
        4 831 0           0.0
        4 846 0           0.0
        4 848 0           0.0
        4 861 1           0.8
        4 863 0           0.05
        4 886 0           0.3
        4 901 0           0.0
        4 903 0           0.0

SQL Call

In this call, the ROCValues, AUC, and Gini syntax elements default to the values 'true', 'false', and 'false', respectively.

SELECT * FROM ROC (
  ON roc_input AS InputTable
  OUT TABLE OutputTable (roc_out_1)
  USING
  ModelIdColumn ('model_id')
  ProbabilityColumn ('probability')
  ObservationColumn ('observation')
  PositiveClass ('1')
  NumThresholds (100)
) AS dt;

Output

 info          
 ------------- 
 ROC complete.
SELECT * FROM roc_out_1;
 model_id threshold          tpr               fpr                
 -------- ------------------ ----------------- ------------------ 
        1                0.0               1.0                1.0
        1 0.0101010101010101               1.0  0.266666666666667
        1 0.0202020202020202               1.0  0.266666666666667
        1 0.0303030303030303               1.0  0.266666666666667
        1 0.0404040404040404               1.0  0.266666666666667
        ...
        2                0.0               1.0                1.0
        2 0.0101010101010101               1.0                0.4
        2 0.0202020202020202               1.0                0.4
        2 0.0303030303030303               1.0                0.4
        2 0.0404040404040404               1.0                0.4
        ...
        3                0.0               1.0                1.0
        3 0.0101010101010101               1.0  0.583333333333333
        3 0.0202020202020202               1.0  0.583333333333333
        3 0.0303030303030303               1.0  0.583333333333333
        3 0.0404040404040404               1.0  0.583333333333333
        ...
        4                0.0               1.0                1.0
        4 0.0101010101010101               1.0              0.375
        4 0.0202020202020202               1.0              0.375
        4 0.0303030303030303               1.0              0.375
        4 0.0404040404040404               1.0              0.375
        ...

Download a zip file of all examples and a SQL script file that creates their input tables.