Shortcuts

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 Ensemble on provided data using either loss or an EvalMetric to quantify performance. Returns bootstrapped mean importance from sample constructed by computing importance for each Model in ensemble.

Parameters:
  • ensemble (AbsEnsemble) – Ensemble to use to evaluate feature importance

  • fy (FoldYielder) – FoldYielder interfacing to data used to train models in ensemble

  • bs (Optional[int]) – If set, will evaluate model in batches of data, rather than all at once

  • eval_metric (Optional[EvalMetric]) – Optional EvalMetric to use to quantify performance in place of loss

  • savename (Optional[str]) – Optional name of file to which to save the plot of feature importances

  • settings (PlotSettings) – PlotSettings class 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 Model on provided data using either loss or an EvalMetric to quantify performance. Returns bootstrapped mean importance from sample constructed by computing importance for each fold in fy.

Parameters:
  • model (AbsModel) – Model to use to evaluate feature importance

  • fy (FoldYielder) – FoldYielder interfacing to data used to train model

  • bs (Optional[int]) – If set, will evaluate model in batches of data, rather than all at once

  • eval_metric (Optional[EvalMetric]) – Optional EvalMetric to use to quantify performance in place of loss

  • pb_parent (Optional[ConsoleMasterBar]) – Not used if calling method directly

  • plot (bool) – whether to plot resulting feature importances

  • savename (Optional[str]) – Optional name of file to which to save the plot of feature importances

  • settings (PlotSettings) – PlotSettings class 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))

Module contents

Docs

Access comprehensive developer and user documentation for LUMIN

View Docs

Tutorials

Get tutorials for beginner and advanced researchers demonstrating many of the features of LUMIN

View Tutorials