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

[model:component] Add sampling techniques to address imbalanced dataset #4283

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
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
5 changes: 4 additions & 1 deletion bugbug/models/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import dateutil.parser
import xgboost
from dateutil.relativedelta import relativedelta
from imblearn.over_sampling import SMOTE
from imblearn.pipeline import Pipeline as ImblearnPipeline
from sklearn.compose import ColumnTransformer
from sklearn.feature_extraction import DictVectorizer
from sklearn.pipeline import Pipeline
Expand Down Expand Up @@ -103,7 +105,7 @@ def __init__(self, lemmatization=False):
]
)

self.clf = Pipeline(
self.clf = ImblearnPipeline(
[
(
"union",
Expand All @@ -119,6 +121,7 @@ def __init__(self, lemmatization=False):
]
),
),
("sampler", SMOTE(random_state=1, sampling_strategy="all")),
(
"estimator",
xgboost.XGBClassifier(n_jobs=utils.get_physical_cpu_count()),
Expand Down