Created
May 28, 2020 16:40
-
-
Save cdwijayarathna/5425919a39dea2f8e9d8bf79c02d544d to your computer and use it in GitHub Desktop.
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.ensemble import RandomForestClassifier, VotingClassifier | |
from mlxtend.feature_selection import ColumnSelector | |
from sklearn.pipeline import make_pipeline | |
y = df1.index | |
x = preprocessing.scale(df1) | |
pipe_phy = make_pipeline(ColumnSelector(cols=('A', 'B', 'C')), SVM) | |
pipe_phy = make_pipeline(ColumnSelector(cols=('D', 'E', 'F')), SVM) | |
ens = VotingClassifier(estimators=[pipe_phy, pipe_fa]) | |
cv = KFold(n_splits=10, random_state=None, shuffle=True) | |
for train_index, test_index in cv.split(x): | |
x_train, x_test = x[train_index], x[test_index] | |
y_train, y_test = y[train_index], y[test_index] | |
ens.fit(x_train,y_train) | |
print(ens.score(x_test, y_test)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment