17.10 - DecisionForestPredictの例: 列範囲、OutputProb、Responsesの指定 - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - Advanced SQL Engine分析関数

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
2021年7月
Content Type
プログラミング リファレンス
Publication ID
B035-1206-171K-JPN
Language
日本語 (日本)

入力

  • 入力テーブル: housing_test_sample
     sn                  price                lotsize  bedrooms  bathrms  stories  driveway  recroom  fullbase  gashw  airco  garagepl  prefarea  homestyle
    ---  ---------------------  ---------------------  --------  -------  -------  --------  -------  --------  -----  -----  --------  --------  ---------
    329  1.15442000000000E 005  7.00000000000000E 003         3        2        4  yes       no       no        no     yes           2  no        bungalow
    224  7.85000000000000E 004  2.81700000000000E 003         4        2        2  no        yes      yes       no     no            1  no        Eclectic
    198  4.05000000000000E 004  4.35000000000000E 003         3        1        2  no        no       no        yes    no            1  no        Classic
    162  1.30000000000000E 005  6.00000000000000E 003         4        1        2  yes       no       yes       no     no            2  no        bungalow
    339  1.41000000000000E 005  8.10000000000000E 003         4        1        2  yes       yes      yes       no     yes           2  yes       bungalow
  • モデル: rft_model_classification
    worker_ip      task_index  tree_num  tree
    -------------  ----------  --------  ----
    172.24.57.209           1         0  {"responseCounts_":{"classic":48,"bungalow":21,"eclectic":97},
    172.24.96.213           0         0  {"responseCounts_":{"classic":48,"bungalow":17,"eclectic":99},
    172.24.106.80           2         0  {"responseCounts_":{"classic":40,"bungalow":16,"eclectic":108},
    172.24.57.209           1         1  {"responseCounts_":{"classic":73,"bungalow":30,"eclectic":107},
    172.24.96.213           0         1  {"responseCounts_":{"classic":66,"bungalow":23,"eclectic":114},
    172.24.106.80           2         1  {"responseCounts_":{"classic":65,"bungalow":24,"eclectic":115},
    172.24.57.209           1         2  {"responseCounts_":{"classic":61,"bungalow":19,"eclectic":80},
    172.24.96.213           0         2  {"responseCounts_":{"classic":47,"bungalow":18,"eclectic":93},
    172.24.106.80           2         2  {"responseCounts_":{"classic":53,"bungalow":8,"eclectic":97},

    (前の画面では、ツリー列は右側で切り捨てられています。)

SQL呼び出し

SELECT * FROM DecisionForestPredict (
  ON housing_test_sample PARTITION BY ANY
  ON rft_model_classification AS Model DIMENSION
  USING
  NumericInputs ('[1:5]','garagepl')
  CategoricalInputs ('[6:10]','prefarea')
  IdColumn ('sn')
  Accumulate ('homestyle')
  Detailed ('false')
  OutputProb ('t')
  Responses ('classic','eclectic','bungalow')
)AS dt;

出力

homestyle      sn  prediction  prob_classic  prob_eclectic  prob_bungalow
------------  ---  ----------  ------------  -------------  -------------
bungalow      329  bungalow    0.00          0.12           0.88
Eclectic      224  eclectic    0.00          1.00           0.00
Classic       198  classic     0.89          0.11           0.00
bungalow      162  bungalow    0.00          0.44           0.56
bungalow      339  bungalow    0.00          0.44           0.56