Skip to content

Instantly share code, notes, and snippets.

@avisheknag17
Last active June 8, 2019 10:04
Show Gist options
  • Save avisheknag17/e345c6cc0f65fefa07b8f51124d987ff to your computer and use it in GitHub Desktop.
Save avisheknag17/e345c6cc0f65fefa07b8f51124d987ff to your computer and use it in GitHub Desktop.
from sklearn.pipeline import Pipeline
pl_train_x, pl_test_x, pl_train_y, pl_test_y = train_test_split(df_x, df_y)
pl_model = Pipeline([('scaler', StandardScaler()),
('pca', PCA(0.95)),
('regr', ElasticNetCV(cv=5, alphas=[0.1, 0.3, 0.5, 0.7, 1.0]))])
pl_model.fit(pl_train_x, pl_train_y)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment