fatf.vis.lime.plot_lime(lime_explanation: Union[List[Tuple[str, float]], Dict[str, List[Tuple[str, float]]], Dict[str, Dict[str, float]]]) → matplotlib.figure.Figure[source]

Plots a LIME explanation.

This plotting function is intended for the fatf.transparency.lime.Lime, fatf.transparency.predictions.surrogate_explainers.TabularBlimeyLime and fatf.transparency.predictions.surrogate_explainers.TabularBlimeyTree explainers.

lime_explanationDictionary[string, List[Tuple[string, float]]] or Dictionary[string, Dictionary[string, float]] or List[Tuple[string, float]]

An explanation returned by the explain_instance method of the LIME explainer or one of the surrogate explainers. For a classifier this will be a dictionary where the keys are class names and the values are either lists of 2-tuples or dictionaries where the first element (key) is an explanatory feature name and the second element (value) is the importance of this explanatory feature. For regressor explanations this will be simply a list of 2-tuples of the same structure as for the classifier.

Changed in version 0.0.2: Support for surrogate explainer explanations of the form: Dictionary[string, Dictionary[string, float]].


A matplotlib figure with subplots explaining every label in LIME explanation.


The lime_explanation parameter is not a list (regression) or a dictionary (classification). One of the class names is not a string. One of the explanatory features is not a string. One of the explanatory values is not a number.

Examples using fatf.vis.lime.plot_lime