Skip to content

Instantly share code, notes, and snippets.

@securetorobert
Created July 12, 2018 01:04
Show Gist options
  • Save securetorobert/7c22c56b241ccc7463acc48844bfa403 to your computer and use it in GitHub Desktop.
Save securetorobert/7c22c56b241ccc7463acc48844bfa403 to your computer and use it in GitHub Desktop.
Polynomial features and ridge regression model applied to Boston housing data
steps = [
('scalar', StandardScaler()),
('poly', PolynomialFeatures(degree=2)),
('model', Ridge(alpha=10, fit_intercept=True))
]
ridge_pipe = Pipeline(steps)
ridge_pipe.fit(X_train, y_train)
print('Training Score: {}'.format(ridge_pipe.score(X_train, y_train)))
print('Test Score: {}'.format(ridge_pipe.score(X_test, y_test)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment