Python support

Python support using sklearn #

As of version 1.4.3, lassopack supports Stata’s Python integration for lasso2 and cvlasso via the sklearn option.

The lassopack will take advantage of scikit-learn’s Python implementations of the lasso, elastic net and ridge estimators; the speed gains using this package can be large.

The sklearn option requires Stata 16 or higher, a Python installation and scikit-learn (0.24 or higher). See help pystata_integration, here and here for how to set up Python for Stata on your system.

Once you have set up Stata’s Python integration, all you have to do is to add the sklearn option:

insheet using ///
   https://web.stanford.edu/~hastie/ElemStatLearn/datasets/prostate.data, ///
   clear tab
cvlasso lpsa lcavol lweight age lbph svi lcp gleason pgg45, ///
   seed(123) sklearn