KNN Example: OutputProb ('true'), Responses Specified | Teradata Vantage - KNN Example: OutputProb ('true'), Responses Specified - 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ā„¢

SQL Call

SELECT * FROM KNN (
  ON computers_train1_clustered AS TrainingData
  ON computers_test1 AS TestData
  OUT TABLE OutputTable (knn_output_2)
  USING
  K (50)
  ResponseColumn ('computer_category')
  TargetColumns ('price','speed','hd','ram','screen')
  VotingWeight (1)
  TestIDColumn ('id')
  OutputProb ('t')
  Responses ('extreme','hyper','mega','special','super','uber','ultra','ultrasuper')
) AS dt ;

Output

This query returns the following table:

SELECT * FROM knn_output_2 ORDER BY id;
         id  prediction                      prob_extreme              prob_hyper               prob_mega            prob_special              prob_super               prob_uber              prob_ultra         prob_ultrasuper
-----------  --------------------  ----------------------  ----------------------  ----------------------  ----------------------  ----------------------  ----------------------  ----------------------  ----------------------
         91  hyper                  0.00000000000000E 000   1.00000000000000E 000   0.00000000000000E 000   0.00000000000000E 000   0.00000000000000E 000   0.00000000000000E 000   0.00000000000000E 000   0.00000000000000E 000
         93  mega                   0.00000000000000E 000   0.00000000000000E 000   1.00000000000000E 000   0.00000000000000E 000   0.00000000000000E 000   0.00000000000000E 000   0.00000000000000E 000   0.00000000000000E 000
        112  super                  0.00000000000000E 000   0.00000000000000E 000   0.00000000000000E 000   0.00000000000000E 000   1.00000000000000E 000   0.00000000000000E 000   0.00000000000000E 000   0.00000000000000E 000
        122  super                  0.00000000000000E 000   0.00000000000000E 000   0.00000000000000E 000   0.00000000000000E 000   1.00000000000000E 000   0.00000000000000E 000   0.00000000000000E 000   0.00000000000000E 000
        135  special                0.00000000000000E 000   0.00000000000000E 000   0.00000000000000E 000   6.57223859017317E-001   3.42776140982683E-001   0.00000000000000E 000   0.00000000000000E 000   0.00000000000000E 000
        153  uber                   0.00000000000000E 000   0.00000000000000E 000   0.00000000000000E 000   0.00000000000000E 000   0.00000000000000E 000   1.00000000000000E 000   0.00000000000000E 000   0.00000000000000E 000
        199  super                  0.00000000000000E 000   0.00000000000000E 000   0.00000000000000E 000   0.00000000000000E 000   1.00000000000000E 000   0.00000000000000E 000   0.00000000000000E 000   0.00000000000000E 000
        209  mega                   0.00000000000000E 000   0.00000000000000E 000   9.68588381270587E-001   0.00000000000000E 000   3.14116187294131E-002   0.00000000000000E 000   0.00000000000000E 000   0.00000000000000E 000