Skip to content

Commit

Permalink
bagging and pasting
Browse files Browse the repository at this point in the history
  • Loading branch information
LordSomen committed Jul 23, 2018
1 parent e3a2302 commit eb7018c
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion Ensemble_learning/ensemble_learning.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,19 @@
for clf in (log_clf, rand_clf, svc_clf, vote_clf):
clf.fit(X_train, Y_train)
Y_pred = clf.predict(X_test)
print(clf.__class__.__name__, accuracy_score(Y_test, Y_pred))
print(clf.__class__.__name__, accuracy_score(Y_test, Y_pred))

#%%
from sklearn.tree import DecisionTreeClassifier
from sklearn.ensemble import BaggingClassifier

bag_clf = BaggingClassifier(DecisionTreeClassifier(),
n_estimators=500,
max_samples=100,bootstrap=False,n_jobs=1)

bag_clf.fit(X_train,Y_train)

#%%
prediction = bag_clf.predict(X_test)
print(accuracy_score(Y_test,prediction))

0 comments on commit eb7018c

Please sign in to comment.