Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
GilesStrong committed Dec 9, 2020
1 parent 9a45395 commit 898e805
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 8 deletions.
4 changes: 2 additions & 2 deletions examples/Feature_Selection.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2230,7 +2230,7 @@
"from lumin.optimisation.features import auto_filter_on_linear_correlation\n",
"\n",
"filtered_feats = auto_filter_on_linear_correlation(train_df=train_df.loc[trn_idxs], val_df=train_df.loc[val_idxs],\n",
" check_feats=hl_feats, subsample_rate=0.01, n_rfs=5,\n",
" check_feats=hl_feats, subsample_rate=subsample_rate, n_rfs=5,\n",
" corr_threshold=0.8, rf_params=rf_params, optimise_rf=False,\n",
" objective='classification', targ_name='gen_target',\n",
" wgt_name='gen_weight', strat_key='gen_target')"
Expand Down Expand Up @@ -2882,7 +2882,7 @@
" check_feats=import_feats,\n",
" objective='classification', targ_name='gen_target',\n",
" strat_key='gen_target', wgt_name='gen_weight',\n",
" subsample_rate=0.3,\n",
" subsample_rate=subsample_rate,\n",
" rf_params=OrderedDict({'min_samples_leaf': [2,4,8,16,32],\n",
" 'max_features': [0.3,0.5,0.7,0.9]}),\n",
" optimise_rf=True)"
Expand Down
2 changes: 1 addition & 1 deletion lumin/nn/callbacks/cyclic_callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from fastcore.all import store_attr

from .callback import Callback, OldCallback
from ..models.abs_model import AbsModel, OldAbsModel
from ..models.abs_model import OldAbsModel
from ...plotting.plot_settings import PlotSettings

import seaborn as sns
Expand Down
3 changes: 0 additions & 3 deletions lumin/nn/callbacks/monitors.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from fastcore.all import store_attr
import math
from typing import Optional
import numpy as np
from fastprogress.fastprogress import IN_NOTEBOOK
from IPython.display import display
Expand All @@ -10,8 +9,6 @@
import seaborn as sns

from .callback import Callback
from ..models.abs_model import AbsModel
from ...plotting.plot_settings import PlotSettings

__all__ = ['EarlyStopping', 'SaveBest', 'MetricLogger']

Expand Down
3 changes: 2 additions & 1 deletion lumin/nn/data/fold_yielder.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,15 @@ def columns(self) -> List[str]:

return [k for k in self.foldfile["fold_0"].keys()]

def add_ignore(self, feats:List[str]) -> None:
def add_ignore(self, feats:Union[str,List[str]]) -> None:
r'''
Add features to ignored features.
Arguments:
feats: list of feature names to ignore
'''

if not is_listy(feats): feats = [feats]
self._ignore_feats += feats
self.cont_feats = [f for f in self.cont_feats if f not in self._ignore_feats]
self.cat_feats = [f for f in self.cat_feats if f not in self._ignore_feats]
Expand Down
2 changes: 1 addition & 1 deletion lumin/nn/models/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def fit(self, n_epochs:int, fy:FoldYielder, bs:int, bulk_move:bool=True, train_o
elif not is_listy(cbs): cbs = [cbs]
cyclic_cbs,loss_cbs = [],[]
for c in cbs:
if isinstance(c, AbsCyclicCallback): cyclic_cbs.append(c) # CBs that might prrevent a model from stopping training due to a hyper-param cycle
if isinstance(c, AbsCyclicCallback): cyclic_cbs.append(c) # CBs that might prevent a model from stopping training due to a hyper-param cycle
if hasattr(c, "get_loss"): loss_cbs.append(c) # CBs that produce alternative losses that should be considered

self.fit_params = FitParams(cbs=cbs, cyclic_cbs=cyclic_cbs, loss_cbs=loss_cbs, stop=False, n_epochs=n_epochs, fy=fy, val_idx=val_idx, bs=bs,
Expand Down

0 comments on commit 898e805

Please sign in to comment.