Skip to content

Instantly share code, notes, and snippets.

@sagarhowal
Created December 6, 2017 10:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sagarhowal/c7afc840bda64dda1b0983968794a346 to your computer and use it in GitHub Desktop.
Save sagarhowal/c7afc840bda64dda1b0983968794a346 to your computer and use it in GitHub Desktop.
Bagging Pasting for Ensemble Learning
from sklearn.ensemble import BaggingClassifier
from sklearn.tree import DecisionTreeClassifier
bag_clf = BaggingClassifier(
DecisionTreeClassifier(random_state=42), n_estimators=500,
max_samples=100, bootstrap=True, n_jobs=-1, random_state=42)
bag_clf.fit(X_train, y_train)
y_pred = bag_clf.predict(X_test)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment