Classes to build objects to better interpret predictions of a model

class Interpretation[source]

Interpretation(learn, dl, losses, act=None)

Interpretation base class, can be inherited for task specific Interpretation classes

Interpretation is a helper base class for exploring predictions from trained models. It can be inherited for task specific interpretation classes, such as ClassificationInterpretation. Interpretation is memory efficient and should be able to process any sized dataset, provided the hardware could train the same model.


Interpretation.from_learner(learn, ds_idx=1, dl=None, act=None)

Construct interpretation object from a learner


Interpretation.top_losses(k=None, largest=True, items=False)

k largest(/smallest) losses and indexes, defaulting to all losses (sorted by largest). Optionally include items.

With the default of k=None, top_losses will return the entire dataset's losses. top_losses can optionally include the input items for each loss, which is usually a file path or Pandas DataFrame.


Interpretation.plot_top_losses(k, largest=True, **kwargs)

Show k largest(/smallest) preds and losses. k may be int, list, or range of desired results.

To plot the first 9 top losses:

interp = Interpretation.from_learner(learn)

Then to plot the 7th through 16th top losses:



Interpretation.show_results(idxs, **kwargs)

Show predictions and targets of idxs

Like Learner.show_results, except can pass desired index or indicies for item(s) to show results from.

class ClassificationInterpretation[source]

ClassificationInterpretation(learn, dl, losses, act=None) :: Interpretation

Interpretation methods for classification models.

class SegmentationInterpretation[source]

SegmentationInterpretation(learn, dl, losses, act=None) :: Interpretation

Interpretation methods for segmentation models.