GLMPredict_MLE Example: Logistic Distribution Prediction - Teradata Vantage

Machine Learning Engine Analytic Function Reference

Product
Teradata Vantage
Release Number
8.10
1.1
Published
October 2019
Language
English (United States)
Last Update
2019-12-31
dita:mapPath
ima1540829771750.ditamap
dita:ditavalPath
jsj1481748799576.ditaval
dita:id
B700-4003
lifecycle
previous
Product Category
Teradata Vantageā„¢

Input

admissions_test
id masters gpa stats programming admitted
50 yes 3.95 Beginner Beginner 0
51 yes 3.76 Beginner Beginner 0
52 no 3.7 Novice Beginner 1
53 yes 3.5 Beginner Novice 1
54 yes 3.5 Beginner Advanced 1
55 no 3.6 Beginner Advanced 1
56 no 3.82 Advanced Advanced 1
57 no 3.71 Advanced Advanced 1
58 no 3.13 Advanced Advanced 1
59 no 3.65 Novice Novice 1
60 no 4 Advanced Novice 1
61 yes 4 Advanced Advanced 1
62 no 3.7 Advanced Advanced 1
63 no 3.83 Advanced Advanced 1
64 yes 3.81 Advanced Advanced 1
65 yes 3.9 Advanced Advanced 1
66 no 3.87 Novice Beginner 1
67 yes 3.46 Novice Beginner 0
68 no 1.87 Advanced Novice 1
69 no 3.96 Advanced Advanced 1

SQL Call

CREATE MULTISET TABLE glmpredict_admissions AS (
    SELECT * FROM GLMPredict_MLE (
    ON admissions_test PARTITION BY ANY
    ON glm_admissions_model AS Model DIMENSION
    USING
    Accumulate ('id', 'masters', 'gpa', 'stats', 'programming', 'admitted')
    Family ('LOGISTIC')
    LinkFunction ('LOGIT')
    OutputProb ('t')
  ) AS dt
) WITH DATA;

Output

SELECT * FROM glmpredict_admissions ORDER BY 1;
 id masters gpa  stats    programming admitted fitted_value       prediction prob               
 -- ------- ---- -------- ----------- -------- ------------------ ---------- ------------------ 
 50 yes     3.95 beginner beginner           0 0.3507656829365149          0 0.6492343170634851
 51 yes     3.76 beginner beginner           0 0.3557112671780229          0 0.6442887328219771
 52 no       3.7 novice   beginner           1 0.7583079903427496          1 0.7583079903427496
 53 yes      3.5 beginner novice             1 0.5560152436940663          1 0.5560152436940663
 54 yes      3.5 beginner advanced           1 0.7694761266019933          1 0.7694761266019933
 55 no       3.6 beginner advanced           1 0.9680314543695169          1 0.9680314543695169
 56 no      3.82 advanced advanced           1 0.9457732442937538          1 0.9457732442937538
 57 no      3.71 advanced advanced           1 0.9464124273756033          1 0.9464124273756033
 58 no      3.13 advanced advanced           1  0.949666669516694          1  0.949666669516694
 59 no      3.65 novice   novice             1 0.8741907950304955          1 0.8741907950304955
 60 no       4.0 advanced novice             1 0.8650601698708184          1 0.8650601698708184
 61 yes      4.0 advanced advanced           1 0.6506209990774642          1 0.6506209990774642
 62 no       3.7 advanced advanced           1 0.9464701812067841          1 0.9464701812067841
 63 no      3.83 advanced advanced           1 0.9457147816580886          1 0.9457147816580886
 64 yes     3.81 advanced advanced           1 0.6555256147282206          1 0.6555256147282206
 65 yes      3.9 advanced advanced           1 0.6532064285302687          1 0.6532064285302687
 66 no      3.87 novice   beginner           1 0.7547403697792542          1 0.7547403697792542
 67 yes     3.46 novice   beginner           0 0.2600362186838019          0 0.7399637813161981
 68 no      1.87 advanced novice             1 0.8909664987530864          1 0.8909664987530864
 69 no      3.96 advanced advanced           1 0.9449493421287761          1 0.9449493421287761

Download a zip file of all examples and a SQL script file that creates their input tables from the attachment in the left sidebar.