lumin.nn.interpretation package¶
Submodules¶
lumin.nn.interpretation.features module¶
- lumin.nn.interpretation.features.get_ensemble_feat_importance(ensemble, fy, bs=None, eval_metric=None, savename=None, settings=<lumin.plotting.plot_settings.PlotSettings object>)[source]¶
Compute permutation importance of features used by an
Ensembleon provided data using either loss or anEvalMetricto quantify performance. Returns bootstrapped mean importance from sample constructed by computing importance for eachModelin ensemble.- Parameters:
ensemble (
AbsEnsemble) –Ensembleto use to evaluate feature importancefy (
FoldYielder) –FoldYielderinterfacing to data used to train models in ensemblebs (
Optional[int]) – If set, will evaluate model in batches of data, rather than all at onceeval_metric (
Optional[EvalMetric]) – OptionalEvalMetricto use to quantify performance in place of losssavename (
Optional[str]) – Optional name of file to which to save the plot of feature importancessettings (
PlotSettings) –PlotSettingsclass to control figure appearance
- Return type:
DataFrame- Returns:
Pandas DataFrame containing mean importance and associated uncertainty for each feature
- Examples::
>>> fi = get_ensemble_feat_importance(ensemble, train_fy) >>> >>> fi = get_ensemble_feat_importance(ensemble, train_fy ... savename='feat_import') >>> >>> fi = get_ensemble_feat_importance(ensemble, train_fy, ... eval_metric=AMS(n_total=100000))
TODO: Weight models
- lumin.nn.interpretation.features.get_nn_feat_importance(model, fy, bs=None, eval_metric=None, pb_parent=None, plot=True, savename=None, settings=<lumin.plotting.plot_settings.PlotSettings object>)[source]¶
Compute permutation importance of features used by a
Modelon provided data using either loss or anEvalMetricto quantify performance. Returns bootstrapped mean importance from sample constructed by computing importance for each fold in fy.- Parameters:
model (
AbsModel) –Modelto use to evaluate feature importancefy (
FoldYielder) –FoldYielderinterfacing to data used to train modelbs (
Optional[int]) – If set, will evaluate model in batches of data, rather than all at onceeval_metric (
Optional[EvalMetric]) – OptionalEvalMetricto use to quantify performance in place of losspb_parent (
Optional[ConsoleMasterBar]) – Not used if calling method directlyplot (
bool) – whether to plot resulting feature importancessavename (
Optional[str]) – Optional name of file to which to save the plot of feature importancessettings (
PlotSettings) –PlotSettingsclass to control figure appearance
- Return type:
DataFrame- Returns:
Pandas DataFrame containing mean importance and associated uncertainty for each feature
- Examples::
>>> fi = get_nn_feat_importance(model, train_fy) >>> >>> fi = get_nn_feat_importance(model, train_fy, savename='feat_import') >>> >>> fi = get_nn_feat_importance(model, train_fy, ... eval_metric=AMS(n_total=100000))