NaiveBayesTextClassifierPredict_MLE Example | Teradata Vantage - NaiveBayesTextClassifierPredict_MLE Example: TopK Omitted, IsTokenized ('true') - 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

  • InputTable: complaints_test_tokenized, created by calling TextTokenizer with the table complaints_test (which appears in NaiveBayesTextClassifierPredict_MLE Example: TopK Specified, IsTokenized ('false')):
    CREATE MULTISET TABLE complaints_test_tokenized AS (
      SELECT * FROM TextTokenizer (
        ON complaints_test PARTITION BY ANY
        USING
        InputLanguage ('en')
        OutputDelimiter (' ')
        OutputByWord ('true')
        Accumulate ('doc_id')
        TextColumn ('text_data')
      ) AS dt
    ) WITH DATA;

SQL Call

SELECT * FROM NaiveBayesTextClassifierPredict_MLE (
  ON complaints_test_tokenized AS PredictorValues PARTITION BY doc_id
  ON complaints_tokens_model AS model DIMENSION
  USING
  ModelType ('Bernoulli')
  DocIdColumns ('doc_id')
  OutputProb ('true')
  Responses ('crash','no_crash')
  IsTokenized ('true')
  InputTokenColumn ('token')
) AS dt;

Output

 doc_id prediction loglik_crash        loglik_no_crash     prob_crash             prob_no_crash        
 ------ ---------- ------------------- ------------------- ---------------------- -------------------- 
      1 no_crash   -132.10325317747862  -98.49860380435018 2.5449907661962356E-15   0.9999999999999976
      2 no_crash   -106.52437650125837  -93.54448794091992   2.306242764321942E-6   0.9999976937572356
      3 no_crash   -104.73220045214514  -74.58391833912108  8.068028793134146E-14   0.9999999999999194
      4 no_crash   -109.99456675440749  -80.17356682652391 1.1191911993954088E-13   0.9999999999998881
      5 crash      -115.57301460364334 -117.93953912203749     0.9142387530879915  0.08576124691200848
      6 no_crash   -131.86161385361245 -116.23728916712048  1.6384829784677584E-7   0.9999998361517022
      7 crash      -111.86019002535706 -115.60577093239516     0.9769232146518676 0.023076785348132414
      8 no_crash   -111.20673632593761  -92.09852084699338   5.028141098952846E-9    0.999999994971859
      9 no_crash   -117.17799816572807 -108.97820056038807   2.746337196143095E-4   0.9997253662803857
     10 no_crash   -105.26809971346323  -82.77619397083092 1.7056481534316895E-10   0.9999999998294351