1.1 - 8.10 - GLML1L2 Example: Ridge Regression, Family ('BINOMIAL') - Teradata Vantage

Teradata Vantage™ - Machine Learning Engine Analytic Function Reference

Product
Teradata Vantage
Release Number
1.1
8.10
Release Date
October 2019
Content Type
Programming Reference
Publication ID
B700-4003-079K
Language
English (United States)

Input

The input table is admission_train, as in GLM Example: Logistic Regression Analysis with Intercept.

SQL Call

Because the response variable is binary (the admitted column has two possible values), the call specifies Family ('BINOMIAL'). Alpha (0) indicates L2 (ridge regression) regularization.

DROP TABLE admissions_model;
DROP TABLE admissions_factor_table;

CREATE MULTISET TABLE admissions_model AS (
  SELECT * FROM GLML1L2 (
   ON admissions_train AS InputTable
   OUT TABLE FactorTable (admissions_factor_table)
   USING
   TargetColumns ('masters', 'gpa', 'stats', 'programming')
   CategoricalColumns ('masters', 'stats', 'programming') 
   ResponseColumn ('admitted') 
   Family ('BINOMIAL') 
   Alpha (0)
   RegularizationLambda (0.02)
  ) AS dt
) WITH DATA;

Output

SELECT * FROM admissions_model;
 attribute      category estimate              information 
 -------------- -------- --------------------- ----------- 
 AIC            NULL         15.21927981934978 NULL       
 programming    beginner   -1.0259430213730834 p          
 Features #     NULL                       6.0 NULL       
 programming    novice     -0.0820786516340258 p          
 masters        yes        -1.2652530272653697 p          
 Iterations #   NULL                      28.0 NULL       
 Lambda         NULL                      0.02 NULL       
 Alpha          NULL                       0.0 NULL       
 stats          beginner   0.08063465501463249 p          
 Regularization NULL                      NULL Ridge      
 stats          novice   -0.026716553307241597 p          
 Family         NULL                      NULL Binomial   
 Converged      NULL                      NULL true       
 gpa            NULL       0.38346423433872745 p          
 Rows #         NULL                      40.0 NULL       
 BIC            NULL        27.041435998147332 NULL       
 (Intercept)    NULL        0.3838162407664626 p
select * from admissions_factor_table;
 masters_yes stats_beginner stats_novice programming_beginner programming_novice gpa  admitted 
 ----------- -------------- ------------ -------------------- ------------------ ---- -------- 
           1              0            1                    1                  0 3.95      0.0
           0              0            0                    0                  0 3.83      1.0
           1              0            1                    0                  1 2.33      1.0
           1              0            0                    1                  0 3.85      0.0
           1              0            1                    1                  0 3.46      0.0
           0              0            0                    0                  1  4.0      1.0
           1              0            0                    1                  0 3.75      0.0
           1              0            0                    1                  0 3.46      0.0
           0              0            1                    0                  1 3.52      1.0
           0              0            0                    0                  0 3.13      1.0
           0              0            1                    1                  0 3.68      1.0
           0              0            0                    0                  0 3.82      1.0
           0              0            1                    0                  1 3.65      1.0
           0              0            0                    0                  0 3.93      1.0
           1              0            0                    0                  0 3.96      0.0
           0              0            0                    0                  0  3.7      1.0
           1              1            0                    0                  1  3.5      1.0
           0              0            1                    0                  1 3.55      1.0
           1              0            0                    0                  0 1.98      0.0
           0              0            0                    0                  0 3.71      1.0
           0              0            0                    0                  1  3.0      0.0
           1              0            0                    1                  0 2.65      1.0
           1              0            0                    0                  0  4.0      1.0
           1              0            0                    0                  0 3.57      1.0
           1              0            0                    0                  1 3.79      0.0
           0              0            1                    0                  1 3.44      0.0
           1              0            0                    0                  0 3.45      0.0
           0              0            0                    0                  1 1.87      1.0
           1              0            0                    1                  0  3.5      1.0
           0              0            1                    1                  0  3.7      1.0
           1              0            1                    1                  0  4.0      0.0
           1              1            0                    1                  0 3.95      0.0
           1              1            0                    0                  0  3.5      1.0
           1              0            0                    0                  0  3.9      1.0
           1              0            0                    0                  1 3.59      1.0
           1              0            0                    0                  0 3.81      1.0
           0              0            1                    1                  0 3.87      1.0
           0              1            0                    0                  0  3.6      1.0
           0              0            0                    0                  0 3.96      1.0
           1              1            0                    1                  0 3.76      0.0

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