Created
April 17, 2019 12:26
-
-
Save joseph-allen/5dd381f11a5f286d44d0fd4c954f9296 to your computer and use it in GitHub Desktop.
generates polynomial features out of any
This file contains 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
from sklearn.preprocessing import PolynomialFeatures | |
p = PolynomialFeatures(degree=2).fit(df[['feature1','feature2]]) | |
features = pd.DataFrame(p.transform(df[['feature1','feature2]]), columns=p.get_feature_names(df[['feature1','feature2]].columns)) | |
features.head() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment