Skip to content

Instantly share code, notes, and snippets.

@dyerrington
Created November 10, 2017 04:19
Show Gist options
  • Save dyerrington/c387d811ac16eb92f9d407ab25d7a8d4 to your computer and use it in GitHub Desktop.
Save dyerrington/c387d811ac16eb92f9d407ab25d7a8d4 to your computer and use it in GitHub Desktop.
Just a basic example of loading a baseline Lasso model without validation. Putting this here for students who just need to load up the Boston Housing dataset and start building a basic regression pipeline.
from sklearn.linear_model import ElasticNetCV
from sklearn.datasets import load_boston
data = load_boston()
df = pd.DataFrame(data['data'], columns=data['feature_names'])
X, y = df, data['target']
elastic = ElasticNetCV(cv=5)
model = elastic.fit(X, y )
pd.DataFrame(model.mse_path_).plot()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment