Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix mrbbagging pipeline compatibility #64

Merged
merged 3 commits into from
Aug 10, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
notebook??
  • Loading branch information
hancia committed Aug 5, 2020
commit c266de01f35ae64d1b078b856c464d51fb6da9fc
18 changes: 16 additions & 2 deletions examples/ensemble/mrbbagging_pipeline.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,21 @@
"collapsed": true
},
"outputs": [],
"source": []
"source": [
"from multi_imbalance.ensemble.mrbbagging import MRBBagging\n",
"from sklearn.pipeline import make_pipeline\n",
"from sklearn.model_selection import cross_val_score, ShuffleSplit\n",
"from multi_imbalance.utils.data import load_arff_dataset\n",
"from sklearn.preprocessing import StandardScaler\n",
"from sklearn.tree import tree\n",
"import os\n",
"\n",
"# an example of how mrbbagging can be used in sklearn pipeline\n",
"X, y = load_arff_dataset(f'{os.getcwd()}\\\\data\\\\arff\\\\new_ecoli.arff')\n",
"clf = make_pipeline(StandardScaler(), MRBBagging(30, tree.DecisionTreeClassifier()))\n",
"cv = ShuffleSplit(n_splits=5, test_size=0.3, random_state=0)\n",
"print(cross_val_score(clf, X, y, cv=cv))"
]
}
],
"metadata": {
Expand All @@ -31,4 +45,4 @@
},
"nbformat": 4,
"nbformat_minor": 0
}
}