Created
July 12, 2018 00:56
-
-
Save securetorobert/8134a7511718542e8ef93be1c9c1acf0 to your computer and use it in GitHub Desktop.
Create polynomial features on a linear regression model for Boston housing data
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
steps = [ | |
('scalar', StandardScaler()), | |
('poly', PolynomialFeatures(degree=2)), | |
('model', LinearRegression()) | |
] | |
pipeline = Pipeline(steps) | |
pipeline.fit(X_train, y_train) | |
print('Training score: {}'.format(pipeline.score(X_train, y_train))) | |
print('Test score: {}'.format(pipeline.score(X_test, y_test))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment