# 1.0 - 8.00 - GLM2 Example 1: LASSO for Poisson Regression Analysis - Teradata Vantage

## Teradata® Vantage Machine Learning Engine Analytic Function Reference

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

This example uses Poisson regression to predict the number of awards won by students, based on their programming levels and math scores.

## Input

awards
id num_awards prog math
45 0 3 41
108 0 1 41
15 0 3 44
67 0 3 42
... ... ... ...
196 0 2 49
36 1 1 44
155 1 1 46
6 0 2 46
... ... ... ...
38 3 2 50
182 0 2 43
115 0 1 43
14 1 2 54
... ... ... ...

## SQL Call

Because the response variable is a count value (number of awards), the Family is Poisson. The Alpha value, 1, specifies a LASSO model.

```SELECT * FROM GLM2 (
ON awards AS InputTable
OUT TABLE ModelTable (glm2_lasso_model)
OUT TABLE RegularizationTable (glm2_regularization)
USING
InputColumns ('prog', 'math')
ResponseColumn ('num_awards')
Family ('POISSON')
Intercept ('TRUE')
NumLambdas (10)
Alpha (1)
) AS dt;```

## Output

Onscreen Output
dfDevRatio devRatio dfDev deviance lambda
0 2.3155999606359e-15 199 287.672234452864 0.522060074545705
1 0.252835382560055 198 214.938515003069 0.187618662922922
1 0.285724516586101 198 205.477224328577 0.0674266514397151
2 0.291092364886125 197 203.933043413905 0.024231882124864
2 0.292547804908229 197 203.514353730634 0.00870848690800394
2 0.292738550188869 197 203.459481609541 0.00312966792410483
2 0.29276365104296 197 203.452260790758 0.0011247443348819
2 0.29276688972071 197 203.451329113093 0.000404212155898542
2 0.292767310601548 197 203.451208037361 0.000145266316894411
2 0.292767359699846 197 203.451193913144 5.22060074545706e-05
glm2_lasso_model
category information value
A FAMILY : POISSON
A RESPONSE : num_awards
A REGULARIZER : LASSO
A CONVERGED : true
A NUMOBSERVATIONS 200
B has_intercept 1
B alpha 1
B devnull 287.672234452865
B maxNumLambdas 10
B maxIterNum 100000
B threshold 1e-07
B minLambdaRatio 0.0001
B iterationNum 79
B minLambda 5.22060074545706e-05
C intercept -5.5766613646
C math 0.0861044506
C prog 0.1230769507
glm2_regularization
df_dev_ratio deviance_ratio df_dev deviance lambda intercept math prog
0 2.3155999606359e-15 199 287.672234452864 0.522060074545705 -0.4620354596 0 0
1 0.252835382560055 198 214.938515003069 0.187618662922922 -3.474053956 0.0546564845 0
1 0.285724516586101 198 205.477224328577 0.0674266514397151 -4.6383122967 0.0745575487 0
2 0.291092364886125 197 203.933043413905 0.024231882124864 -5.1481338496 0.0819282453 0.0350038202
2 0.292547804908229 197 203.514353730634 0.00870848690800394 -5.4215383741 0.0846018544 0.0911403822
2 0.292738550188869 197 203.459481609541 0.00312966792410483 -5.5210823104 0.0855658029 0.1116709262
2 0.29276365104296 197 203.452260790758 0.0011247443348819 -5.5575725933 0.0859216969 0.1190959763
2 0.29276688972071 197 203.451329113093 0.000404212155898542 -5.5706478142 0.0860486438 0.1217705047
2 0.292767310601548 197 203.451208037361 0.000145266316894411 -5.5753457856 0.0860942091 0.1227324598
2 0.292767359699846 197 203.451193913144 5.22060074545706e-05 -5.5766613646 0.0861044506 0.1230769507