Skip to content

Commit f69020e

Browse files
committed
improved documentation for fcc
1 parent 25f3287 commit f69020e

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

src/Microsoft.ML.Data/Transforms/FeatureContributionCalculationTransform.cs

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,29 @@
2525
namespace Microsoft.ML.Data
2626
{
2727
/// <summary>
28-
/// The FeatureContributionCalculationTransformer computes model-specific contribution scores for each feature.
28+
/// The FeatureContributionCalculationTransformer computes model-specific per-feature contributions to the score of each data point.
2929
/// See the list of currently supported models below.
3030
/// </summary>
3131
/// <remarks>
32+
/// <para>
33+
/// Scorind a data set with a trained model produces a score, or prediction, for each data sample. To understand and explain these predictions
34+
/// it can be useful to inspect which features influenced them most significantly. FeatureContributionCalculationTransformer computes a model-specific
35+
/// list of per-feature contributions to the score for each data sample. These contributions can be positive (they make the score higher) or negative
36+
/// (they make the score lower).
37+
/// </para>
38+
/// <para>
39+
/// For linear models, the contribution of a given feature is just equal to the product of feature times the corresponding weight. Similarly, for
40+
/// Generalized Additive Models (GAM), the contrubution of a feature is equal to the shape function for the given feature evaluated at the feature value.
41+
/// </para>
42+
/// <para>
43+
/// For tree based models, the contribution of a feature is equal to the change in score produced by exploring the opposite sub-tree every time a decision
44+
/// node for the given feature is encountered. Consider a simple case with a singe decision tree that has a decision node for the binary feature F1.
45+
/// Given a data sample that has feature F1 equal to true, we can calculate the score it would have obtained if we chose the subtree corresponding to
46+
/// the feature F1 being equal to false while keeping the other features constant. The contribution of feature F1 for the given sample is the difference
47+
/// between the original score and the score obtained by taking the opposite decision at the node corresponding to feature F1. This algorithm extendes
48+
/// naturally to models with many decision trees.
49+
/// </para>
50+
/// <para>
3251
/// Feature Contribution Calculation is currently supported for the following models:
3352
/// Regression:
3453
/// OrdinaryLeastSquares, StochasticDualCoordinateAscent (SDCA), OnlineGradientDescent, PoissonRegression,
@@ -39,8 +58,10 @@ namespace Microsoft.ML.Data
3958
/// FastForest, FastTree, LightGbm
4059
/// Ranking:
4160
/// FastTree, LightGbm
42-
///
61+
/// </para>
62+
/// <para>
4363
/// See the sample below for an example of how to compute feature importance using the FeatureContributionCalculatingTransformer.
64+
/// </para>
4465
/// </remarks>
4566
/// <example>
4667
/// <format type="text/markdown">

0 commit comments

Comments
 (0)