FeatureValueImpactPlot
FeatureValueImpactPlot[model,data]
plots the impact of the value of a given feature in data on the result of model.
FeatureValueImpactPlot[model]
estimates the feature value impact using synthetic data.
FeatureValueImpactPlot[modelfname,…]
plots only the impact of the specified feature fname.
FeatureValueImpactPlot[modelfnameclass,…]
plots only the impact on the classification class.
Details and Options
- FeatureValueImpactPlot is used to interpret the contribution of examples' feature values to the results of a machine learning model like a predictor or a classifier.
- 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 impact is plotted as a function of . The impact on the value is the deviation from the mean value according to :
- Possible values for model are:
-
ClassifierFunction[…] a classification model PredictorFunction[…] a regression model - 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 data are:
-
example a single example {example1,…} a List, Association or Dataset of examples Automatic uses the model's missing imputer to generate examples - If no data is provided, synthetic examples will be generated using the model's missing value synthesizer based on training data.
- Possible values for fname are:
-
All impact of all the features (default) feature impact of feature only {feature1,…} impact of a list of featurei - When model is a ClassifierFunction[…], possible values for class are:
-
All impact on all the classes (default) name impact on class name only {name1,…} impact on a list of namei - FeatureValueImpactPlot has the same options as Graphics, with the following additions and changes: [List of all options]
-
AspectRatio 1/GoldenRatio ratio of height to width Axes True whether to draw axes AxesLabel Automatic axes labels DataRange Automatic the range of x values to assume for data IntervalMarkers Automatic how to render uncertainty IntervalMarkersStyle Automatic style for uncertainty elements Filling None how to fill in stems for each point FillingStyle Automatic style to use for filling Joined False whether to join points LabelingFunction Automatic how to label points LabelingSize Automatic maximum size of callouts and labels MultiaxisArrangement None how to arrange multiple axes for data PerformanceGoal $PerformanceGoal aspects of performance to try to optimize PlotLabel Automatic overall label for the plot PlotLabels Automatic labels for data PlotLayout "Overlaid" how to position data PlotLegends None legends for data PlotMarkers None markers to use to indicate each point PlotRange Automatic range of values to include PlotRangeClipping True whether to clip at the plot range PlotStyle Automatic graphics directives to determine styles of points PlotTheme $PlotTheme overall theme for the plot ScalingFunctions Automatic how to scale individual coordinates TargetUnits Automatic units to display in the plot -
AlignmentPoint Center the default point in the graphic to align with AspectRatio 1/GoldenRatio ratio of height to width Axes True whether to draw axes AxesLabel Automatic axes labels AxesOrigin Automatic where axes should cross AxesStyle {} style specifications for the axes Background None background color for the plot BaselinePosition Automatic how to align with a surrounding text baseline BaseStyle {} base style specifications for the graphic ContentSelectable Automatic whether to allow contents to be selected CoordinatesToolOptions Automatic detailed behavior of the coordinates tool DataRange Automatic the range of x values to assume for data Epilog {} primitives rendered after the main plot Filling None how to fill in stems for each point FillingStyle Automatic style to use for filling FormatType TraditionalForm the default format type for text Frame False whether to put a frame around the plot FrameLabel None frame labels FrameStyle {} style specifications for the frame FrameTicks Automatic frame ticks FrameTicksStyle {} style specifications for frame ticks GridLines None grid lines to draw GridLinesStyle {} style specifications for grid lines ImageMargins 0. the margins to leave around the graphic ImagePadding All what extra padding to allow for labels etc. ImageSize Automatic the absolute size at which to render the graphic IntervalMarkers Automatic how to render uncertainty IntervalMarkersStyle Automatic style for uncertainty elements Joined False whether to join points LabelingFunction Automatic how to label points LabelingSize Automatic maximum size of callouts and labels LabelStyle {} style specifications for labels Method Automatic details of graphics methods to use MultiaxisArrangement None how to arrange multiple axes for data PerformanceGoal $PerformanceGoal aspects of performance to try to optimize PlotLabel Automatic overall label for the plot PlotLabels Automatic labels for data PlotLayout "Overlaid" how to position data PlotLegends None legends for data PlotMarkers None markers to use to indicate each point PlotRange Automatic range of values to include PlotRangeClipping True whether to clip at the plot range PlotRangePadding Automatic how much to pad the range of values PlotRegion Automatic the final display region to be filled PlotStyle Automatic graphics directives to determine styles of points PlotTheme $PlotTheme overall theme for the plot PreserveImageOptions Automatic whether to preserve image options when displaying new versions of the same graphic Prolog {} primitives rendered before the main plot RotateLabel True whether to rotate y labels on the frame ScalingFunctions Automatic how to scale individual coordinates TargetUnits Automatic units to display in the plot Ticks Automatic axes ticks TicksStyle {} style specifications for axes ticks
List of all options
Examples
open allclose allBasic Examples (2)
Train a linear regression on a sample dataset:
Visualize the impact of the input feature on the average model result:
Compare the plot with the numerical deviation between the average and the prediction:
Train a classifier to identify an Iris species from some features of the plant:
Visualize how a feature value affects the odds of each class:
Scope (4)
Options (12)
FrameLabel (2)
MaxPlotPoints (1)
PlotLegends (1)
Applications (1)
Analyze how different models are affected by feature variations:
Train a linear model to predict a value given by the nonlinear combination of two features:
As expected, the impact of each feature depends only on that feature value:
Train a nonlinear model on the same data:
Now the same feature value can have different impacts depending on the other feature in the example:
Text
Wolfram Research (2022), FeatureValueImpactPlot, Wolfram Language function, https://reference.wolfram.com/language/ref/FeatureValueImpactPlot.html.
CMS
Wolfram Language. 2022. "FeatureValueImpactPlot." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/FeatureValueImpactPlot.html.
APA
Wolfram Language. (2022). FeatureValueImpactPlot. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/FeatureValueImpactPlot.html