Skip to content

Instantly share code, notes, and snippets.

@wmlba
Last active December 28, 2020 08:38
Show Gist options
  • Save wmlba/803147cce5526004feae574ff92ed164 to your computer and use it in GitHub Desktop.
Save wmlba/803147cce5526004feae574ff92ed164 to your computer and use it in GitHub Desktop.
from imblearn.ensemble import BalancedBaggingClassifier
from sklearn.tree import DecisionTreeClassifier
#Create an object of the classifier.
bbc = BalancedBaggingClassifier(base_estimator=DecisionTreeClassifier(),
sampling_strategy='auto',
replacement=False,
random_state=0)
y_train = credit_df['Class']
X_train = credit_df.drop(['Class'], axis=1, inplace=False)
#Train the classifier.
bbc.fit(X_train, y_train)
preds = bbc.predict(X_test)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment