Skip to content

Commit

Permalink
[refactor]: pass random state to classifier object as well
Browse files Browse the repository at this point in the history
  • Loading branch information
ilias-ant committed Jul 19, 2023
1 parent 0a3fba1 commit 264f370
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions advertion/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def _identify_adversarial_features(
Iterable[str]: An iterable of feature names.
"""
print(
f"INFO: Will try to identify adversarial features "
f"INFO: Will try to identify adv. features "
f"(see: https://advertion.readthedocs.io/en/{__version__}/adversarial-features)"
)

Expand Down Expand Up @@ -184,8 +184,7 @@ def __preprocessing(df: pd.DataFrame) -> pd.DataFrame:
"""
return df.select_dtypes(include=np.number).copy()

@staticmethod
def _classifier(**params):
def _classifier(self, **params):
"""Returns a classifier instance.
Args:
Expand All @@ -194,4 +193,4 @@ def _classifier(**params):
Returns:
xgb.XGBClassifier: An XGBoost classifier instance.
"""
return xgb.XGBClassifier(**params)
return xgb.XGBClassifier(**params, random_state=self._random_state)

0 comments on commit 264f370

Please sign in to comment.