Skip to content

Commit

Permalink
add random seed to balancing method for consistent results
Browse files Browse the repository at this point in the history
  • Loading branch information
bagustris committed Jul 1, 2024
1 parent 11f17ab commit 09cd2e4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions nkululeko/modelrunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,21 +238,21 @@ def _check_balancing(self):
if balancing == "ros":
from imblearn.over_sampling import RandomOverSampler

sampler = RandomOverSampler()
sampler = RandomOverSampler(random_state=42)
X_res, y_res = sampler.fit_resample(
self.feats_train, self.df_train[self.target]
)
elif balancing == "smote":
from imblearn.over_sampling import SMOTE

sampler = SMOTE()
sampler = SMOTE(random_state=42)
X_res, y_res = sampler.fit_resample(
self.feats_train, self.df_train[self.target]
)
elif balancing == "adasyn":
from imblearn.over_sampling import ADASYN

sampler = ADASYN()
sampler = ADASYN(random_state=42)
X_res, y_res = sampler.fit_resample(
self.feats_train, self.df_train[self.target]
)
Expand Down

0 comments on commit 09cd2e4

Please sign in to comment.