Last active
September 2, 2021 09:16
-
-
Save elisim/ca2d43393714e9482d0c4be304062a8a to your computer and use it in GitHub Desktop.
Hydra-Sklearn Blog - Code example 2
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.decomposition import PCA | |
from sklearn.ensemble import RandomForestClassifier | |
from sklearn.linear_model import LogisticRegression | |
from sklearn.tree import DecisionTreeClassifier | |
pipeline_lr = Pipeline( | |
[ | |
("imputer", SimpleImputer(strategy="constant", fill_value="-1")), | |
("VarianceThreshold", VarianceThreshold(threshold=0.1)), | |
("scalar1", StandardScaler()), | |
("pca1", PCA(n_components=2)), | |
("lr_classifier", LogisticRegression(random_state=0)), | |
] | |
) | |
pipeline_dt = Pipeline( | |
[ | |
("scalar2", StandardScaler()), | |
("VarianceThreshold", VarianceThreshold(threshold=0.1)), | |
("imputer", SimpleImputer(strategy="constant", fill_value="-1")), | |
("pca2", PCA(n_components=2)), | |
("dt_classifier", DecisionTreeClassifier()), | |
] | |
) | |
pipeline_randomforest = Pipeline( | |
[ | |
("scalar3", StandardScaler()), | |
("pca3", PCA(n_components=2)), | |
("rf_classifier", RandomForestClassifier()), | |
] | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment