posted on January 4, 2016

Purpose: To compile the original Fortran code of GLMNET to use it in Python which contains the Poisson link function that many people and me use in the lab.


clone repository from github

$ git clone

change directory and compile

$ cd glmnet-python
$ python build

compile fortran code

$ cd glmnet/
$ f2py -c --fcompiler=gnu95 --f77flags='-fdefault-real-8' --f90flags='-fdefault-real-8' glmnet.pyf glmnet.f

test code by going to root of project

cd ..

and in IPython run this example to see if it works

from glmnet import ElasticNet
from cv import CVGlmNet
from sklearn.datasets.samples_generator import make_regression

enet = ElasticNet(alpha=.1)
enet_cv = CVGlmNet(enet, n_folds=10, n_jobs=10)
X, y = make_regression(n_samples=100, n_features=10, n_informative=10, random_state=0, noise=35), y)