1.0 - 8.00 - GLM2Predict Example 2: Ridge for Logistic Regression Prediction - Teradata Vantage

Teradata® Vantage Machine Learning Engine Analytic Function Reference

Product
Teradata Vantage
Release Number
1.0
8.00
Release Date
May 2019
Content Type
Programming Reference
Publication ID
B700-4003-098K
Language
English (United States)

Input

The input table is admissions_test, as in GLMPredict Example 1: Logistic Distribution Prediction.

SQL Call

CREATE MULTISET TABLE admissionspredict AS ( 
  SELECT * FROM GLM2Predict (
    ON admissions_test AS "input" PARTITION BY ANY
    ON glm2_ridge_model AS model DIMENSION ORDER BY "category"
    USING
    Accumulate ('id', 'admitted')
  ) AS dt
) WITH DATA;

Output

The Lambda argument was omitted, so the function used the MinLambda value from the model table, glm2_ridge_model.

admissionspredict
id admitted lambda prediction
50 0 0.0216083135455847 0.36511507224068
52 1 0.0216083135455847 0.726496251808762
54 1 0.0216083135455847 0.717408337408593
56 1 0.0216083135455847 0.919800062501089
58 1 0.0216083135455847 0.922851378346457
60 1 0.0216083135455847 0.85873303873771
62 1 0.0216083135455847 0.920338525565984
64 1 0.0216083135455847 0.64109016094362
66 1 0.0216083135455847 0.724430371300696
68 1 0.0216083135455847 0.873776484269566
51 0 0.0216083135455847 0.367806580390766
53 1 0.0216083135455847 0.576347719419299
55 1 0.0216083135455847 0.941897375877604
57 1 0.0216083135455847 0.920293780069925
59 1 0.0216083135455847 0.859789291096852
61 1 0.0216083135455847 0.638418344069472
63 1 0.0216083135455847 0.919755040923749
65 1 0.0216083135455847 0.639825641071193
67 0 0.0216083135455847 0.295549223237937
69 1 0.0216083135455847 0.919167656796922

Binary Prediction Values

To convert the prediction values that the function produced to binary predictions of admission (1 or 0), use these SQL commands:

UPDATE admissionspredict 
SET prediction = 1 WHERE prediction > 0.5;

UPDATE admissionspredict 
SET prediction = 0 WHERE prediction < 0.5;
admissionspredict
id admitted lambda prediction
52 1 0.0216083135455847 1
54 1 0.0216083135455847 1
56 1 0.0216083135455847 1
58 1 0.0216083135455847 1
60 1 0.0216083135455847 1
62 1 0.0216083135455847 1
64 1 0.0216083135455847 1
66 1 0.0216083135455847 1
68 1 0.0216083135455847 1
53 1 0.0216083135455847 1
55 1 0.0216083135455847 1
57 1 0.0216083135455847 1
59 1 0.0216083135455847 1
61 1 0.0216083135455847 1
63 1 0.0216083135455847 1
65 1 0.0216083135455847 1
69 1 0.0216083135455847 1
50 0 0.0216083135455847 0
51 0 0.0216083135455847 0
67 0 0.0216083135455847 0