17.10 - NaiveBayesTextClassifierPredictの例: Responseを指定 - 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
日本語 (日本)

入力

NaiveBayesTextClassifierPredictの例: TopKを指定と同様に、次のようになります。

  • PredictorValues: complaints_test_tokenized
  • モデル: complaints_tokens_model

SQL呼び出し

SELECT * FROM NaiveBayesTextClassifierPredict (
  ON complaints_test_tokenized AS PredictorValues PARTITION BY doc_id
  ON complaints_tokens_model AS Model DIMENSION
  USING
  ModelType ('Bernoulli')
  InputTokenColumn ('token')
  DocIDColumns ('doc_id')
  OutputProb ('true')
  Accumulate ('doc_name')
  Responses ('crash', 'no crash')
) AS dt ORDER BY doc_id;

出力

doc_id  prediction            loglik_crash         loglik_no_crash              prob_crash           prob_no_crash  doc_name
------  ----------  ----------------------  ----------------------  ----------------------  ----------------------  --------
     1  no_crash    -1.38044220625651E 002  -1.17666267644292E 002   1.41243173571687E-009   9.99999998587568E-001  A
     2  no_crash    -1.04652470718918E 002  -9.82811865081127E 001   1.70704288519507E-003   9.98292957114805E-001  B
     3  no_crash    -1.03026451289745E 002  -7.62146044204976E 001   2.26862573862878E-012   9.99999999997731E-001  C
     4  no_crash    -1.10830711173169E 002  -8.58531176043404E 001   1.42026355157382E-011   9.99999999985797E-001  D
     5  crash       -1.20601083912966E 002  -1.23936921216052E 002   9.65637986161646E-001   3.43620138383542E-002  E
     6  no_crash    -1.30310015371040E 002  -1.17454141890718E 002   2.61074198636704E-006   9.99997389258014E-001  F
     7  crash       -1.20005517060745E 002  -1.23123774759574E 002   9.57639606312734E-001   4.23603936872661E-002  G
     8  no_crash    -1.08617321658980E 002  -9.00827983614664E 001   8.92398441816595E-009   9.99999991076016E-001  H
     9  no_crash    -1.19919230739025E 002  -1.16147101713878E 002   2.24857954852037E-002   9.77514204514796E-001  I
    10  no_crash    -1.06104244132225E 002  -8.97078469668254E 001   7.57068462691010E-008   9.99999924293154E-001  J