Skip to Content
Practical Predictive Analytics
book

Practical Predictive Analytics

by Ralph Winters
June 2017
Beginner to intermediate
576 pages
15h 22m
English
Packt Publishing
Content preview from Practical Predictive Analytics

Printing out the possible coefficients based on Lambda

Using some of the lambda values, you can print out the different coefficients for each model.

This will also help you choose a lambda value that is good for your model:

coef(mod.result,s=0.1957000)     #  4 of 5 coefficient are at 0, too much shrinkagecoef(mod.result,s=0.0131800)     #  only 1 coefficient is set to 0coef(mod.result,s=0.0120100)     #   All coefficients are includedcoef(mod.result,s=0.01)

Using a lambda of .01 will use all of the variables, so let's print out the coefficients using that value:

> coef(mod.result,s=0.01) 
7 x 1 sparse Matrix of class "dgCMatrix" 
                                         1 
(Intercept)       -17.57297008856023268208df.Duration -0.000962546 df.TreatmentB -0.33638216397784859168 df.TreatmentP 2.82134076268210698402 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Data Superstream: Analytics Engineering

Data Superstream: Analytics Engineering

Alistair Croll, Anna Filippova, Emilie Schario, Lewis Davies, Jacob Frackson, Benn Stancil, Nick Acosta, Elizabeth Caley
R: Predictive Analysis

R: Predictive Analysis

Tony Fischetti, Eric Mayor, Rui Miguel Forte
Python: Advanced Predictive Analytics

Python: Advanced Predictive Analytics

Ashish Kumar, Joseph Babcock

Publisher Resources

ISBN: 9781785886188Supplemental Content