FeatureImpactPlot

FeatureImpactPlot[model,data]

plots the impact of the value of each feature in data on the result of model.

FeatureImpactPlot[model]

estimates the feature impacts using synthetic data.

FeatureImpactPlot[modelfname,]

plots only the impact of the specified feature fname.

FeatureImpactPlot[modelfnameclass,]

plots only the impact on the classification class.

Details and Options

  • FeatureImpactPlot is used to interpret the contribution of examples' feature values to the results of a machine learning model such as a regression or a classification.
  • Feature impacts are typically used to give insights into the decision process of an otherwise "black-box" machine learning algorithm, understand the model's inner workings, prevent unwanted biases, etc.
  • For every example, the distribution of the impact of is plotted. The impact on the result of model is the deviation from the mean according to :
  • The result of a predictor is a scalar value and si is the deviation from the average prediction .
  • The result of a classifier is typically a vector of log-odds that are returned as probabilities for each class.
  • The impact si is the deviation from the log-odds prior logodds0 for a given class.
  • Possible values for model are:
  • ClassifierFunction[]a classification model
    PredictorFunction[]a regression model
    FittedModel[]a symbolic fitted model
  • Possible values for data are:
  • examplea single example
    {example1,}a List, Association or Dataset of examples
    LearnDistribution[]a distribution from which to generate synthetic examples
    Automaticuses the model's missing imputer to generate examples
  • If no data is provided, synthetic examples will be generated using the model's missing imputer.
  • Possible values for fname are:
  • Allimpact of all the features (default)
    featureimpact of feature only
    {feature1,}impact of a list of featurei
  • When model is a ClassifierFunction[], possible values for class are:
  • Allimpact on all the classes (default)
    nameimpact on class name only
    {name1,}impact on a list of namei
  • FeatureImpactPlot has the same options as Graphics, with the following additions and changes:
  • AspectRatio1/GoldenRatiooverall ratio of height to width
    BarOrigin Leftorigin placement for shapes
    BarSpacingAutomaticfractional spacing between shapes
    ChartBaseStyleAutomaticoverall style for shapes
    ChartElementFunctionAutomatichow to generate raw graphics for shapes
    ChartLabelsAutomaticlabels for data elements and datasets
    ChartLayoutAutomaticoverall layout to use
    ChartLegendsNonelegends for data elements and datasets
    ChartStyle Automaticstyle for shapes
    FrameTruewhether to draw a frame around the chart
    LabelingFunctionAutomatichow to label shapes
    LabelingSizeAutomaticmaximum size of callouts and labels
    LegendAppearanceAutomaticoverall appearance of legends
    MethodAutomaticwhat methods to use
    PerformanceGoal"Speed"aspects of performance to try to optimize
    PlotTheme$PlotThemeoverall theme for the chart
    ScalingFunctionsNonehow to scale individual coordinates
    TargetUnitsAutomaticunits to display in the chart

Examples

open allclose all

Basic Examples  (2)

Train a predictor on a linear problem:

Visualize the distribution of the effect of each feature using random data:

Visualize a summary of the impact of each feature on a predictor result:

Visualize the impact of only two features:

Scope  (3)

Visualize the impact distributions on a prediction task:

Visualize the impact distributions on a classification task:

Select a specific class:

Use synthetic data to compute the impacts:

Options  (2)

BarOrigin  (1)

Specify the origin placement:

ChartStyle  (1)

Use a custom color function:

Specify one color for each feature:

Wolfram Research (2022), FeatureImpactPlot, Wolfram Language function, https://reference.wolfram.com/language/ref/FeatureImpactPlot.html.

Text

Wolfram Research (2022), FeatureImpactPlot, Wolfram Language function, https://reference.wolfram.com/language/ref/FeatureImpactPlot.html.

CMS

Wolfram Language. 2022. "FeatureImpactPlot." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/FeatureImpactPlot.html.

APA

Wolfram Language. (2022). FeatureImpactPlot. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/FeatureImpactPlot.html

BibTeX

@misc{reference.wolfram_2022_featureimpactplot, author="Wolfram Research", title="{FeatureImpactPlot}", year="2022", howpublished="\url{https://reference.wolfram.com/language/ref/FeatureImpactPlot.html}", note=[Accessed: 29-May-2023 ]}

BibLaTeX

@online{reference.wolfram_2022_featureimpactplot, organization={Wolfram Research}, title={FeatureImpactPlot}, year={2022}, url={https://reference.wolfram.com/language/ref/FeatureImpactPlot.html}, note=[Accessed: 29-May-2023 ]}