Skip to content

Commit

Permalink
Merge pull request #31 from Matgenix/random_state
Browse files Browse the repository at this point in the history
Possibility to tune random_state in feature selection. Useful when se…
  • Loading branch information
gbrunin authored Aug 21, 2023
2 parents 98e5fd2 + 54e0119 commit 622a270
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion modnet/preprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -797,6 +797,7 @@ def feature_selection(
drop_thr: float = 0.2,
n_jobs: int = None,
ignore_names: Optional[List] = [],
random_state: int = None,
):
"""Compute the mutual information between features and targets,
then apply relevance-redundancy rankings to choose the top `n`
Expand Down Expand Up @@ -859,7 +860,11 @@ def feature_selection(
else:
df = self.df_featurized.copy()
self.cross_nmi, self.feature_entropy = get_cross_nmi(
df, return_entropy=True, drop_thr=drop_thr, n_jobs=n_jobs
df,
return_entropy=True,
drop_thr=drop_thr,
n_jobs=n_jobs,
random_state=random_state,
)

if self.cross_nmi.isna().sum().sum() > 0:
Expand Down Expand Up @@ -889,6 +894,7 @@ def feature_selection(
df,
df_target,
task_type,
random_state=random_state,
)[name]

LOG.info("Computing optimal features...")
Expand Down

0 comments on commit 622a270

Please sign in to comment.