Skip to content

Commit f829b34

Browse files
authored
XML docs for Permutation feature importance for Binary, Multi-class and Ranking trainers. (#3455)
* XML docs for Permutation feature importance for Binary, Multi-class and Ranking trainers. * PR feedback. * PR feedback. * PR feedback. * PR feedback. * PR feedback. * Add features column to io md file for ranker.. * PR feedback. * PR feedback. * PR feedback.
1 parent dc61418 commit f829b34

File tree

5 files changed

+22
-23
lines changed

5 files changed

+22
-23
lines changed

docs/api-reference/io-columns-multiclass-classification.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
### Input and Output Columns
2-
The input label column data must be [key-typed](xref:Microsoft.ML.Data.KeyDataViewType) and the feature column must be a known-sized vector of <xref:System.Single>.
2+
The input label column data must be [key](xref:Microsoft.ML.Data.KeyDataViewType) type and the feature column must be a known-sized vector of <xref:System.Single>.
33

44
This trainer outputs the following columns:
55

docs/api-reference/io-columns-ranking.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
### Input and Output Columns
2-
The input label column data must be <xref:System.Single> and input group column
3-
data must be <xref:System.UInt32>. This trainer outputs the following columns:
2+
The input label data type must be [key](xref:Microsoft.ML.Data.KeyDataViewType) type or <xref:System.Single>. The value of the label determines relevance, where higher values indicate higher relevance. If the label is a [key](xref:Microsoft.ML.Data.KeyDataViewType) type, then the key index is the relevance value, where the 0-index is the least relevant. If the label is a <xref:System.Single>, larger values indicate higher relevance. The feature column must be a known-sized vector of <xref:System.Single> and input row group column must be [key](xref:Microsoft.ML.Data.KeyDataViewType) type. This trainer outputs the following columns:
43

54
| Output Column Name | Column Type | Description|
65
| -- | -- | -- |

src/Microsoft.ML.FastTree/TreeTrainersCatalog.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public static FastTreeBinaryTrainer FastTree(this BinaryClassificationCatalog.Bi
127127
/// Create a <see cref="FastTreeRankingTrainer"/>, which ranks a series of inputs based on their relevancee, using a decision tree ranking model.
128128
/// </summary>
129129
/// <param name="catalog">The <see cref="RankingCatalog"/>.</param>
130-
/// <param name="labelColumnName">The name of the label column. The column data must be <see cref="System.Single"/>.</param>
130+
/// <param name="labelColumnName">The name of the label column. The column data must be <see cref="System.Single"/> or <see cref="KeyDataViewType"/>.</param>
131131
/// <param name="featureColumnName">The name of the feature column. The column data must be a known-sized vector of <see cref="System.Single"/>.</param>
132132
/// <param name="rowGroupColumnName">The name of the group column.</param>
133133
/// <param name="exampleWeightColumnName">The name of the example weight column (optional).</param>

src/Microsoft.ML.LightGbm/LightGbmCatalog.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public static LightGbmBinaryTrainer LightGbm(this BinaryClassificationCatalog.Bi
123123
/// Create <see cref="LightGbmRankingTrainer"/>, which predicts a target using a gradient boosting decision tree ranking model.
124124
/// </summary>
125125
/// <param name="catalog">The <see cref="RankingCatalog"/>.</param>
126-
/// <param name="labelColumnName">The name of the label column. The column data must be <see cref="System.Single"/>.</param>
126+
/// <param name="labelColumnName">The name of the label column. The column data must be <see cref="System.Single"/> or <see cref="KeyDataViewType"/>.</param>
127127
/// <param name="featureColumnName">The name of the feature column. The column data must be a known-sized vector of <see cref="System.Single"/>.</param>
128128
/// <param name="rowGroupColumnName">The name of the group column.</param>
129129
/// <param name="exampleWeightColumnName">The name of the example weight column (optional).</param>
@@ -178,8 +178,8 @@ public static LightGbmRankingTrainer LightGbm(this RankingCatalog.RankingTrainer
178178
/// Create <see cref="LightGbmMulticlassTrainer"/>, which predicts a target using a gradient boosting decision tree multiclass classification model.
179179
/// </summary>
180180
/// <param name="catalog">The <see cref="MulticlassClassificationCatalog"/>.</param>
181-
/// <param name="labelColumnName">The name of the label column.</param>
182-
/// <param name="featureColumnName">The name of the feature column.</param>
181+
/// <param name="labelColumnName">The name of the label column. The column data must be <see cref="KeyDataViewType"/>.</param>
182+
/// <param name="featureColumnName">The name of the feature column. The column data must be a known-sized vector of <see cref="System.Single"/>.</param>
183183
/// <param name="exampleWeightColumnName">The name of the example weight column (optional).</param>
184184
/// <param name="numberOfLeaves">The maximum number of leaves in one tree.</param>
185185
/// <param name="minimumExampleCountPerLeaf">The minimal number of data points required to form a new tree leaf.</param>

src/Microsoft.ML.Transforms/PermutationFeatureImportanceExtensions.cs

+16-16
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public static class PermutationFeatureImportanceExtensions
1919
{
2020
#region Regression
2121
/// <summary>
22-
/// Permutation Feature Importance (PFI) for Regression
22+
/// Permutation Feature Importance (PFI) for Regression.
2323
/// </summary>
2424
/// <remarks>
2525
/// <para>
@@ -32,14 +32,14 @@ public static class PermutationFeatureImportanceExtensions
3232
/// <para>
3333
/// PFI works by taking a labeled dataset, choosing a feature, and permuting the values
3434
/// for that feature across all the examples, so that each example now has a random value for the feature and
35-
/// the original values for all other features. The evalution metric (e.g. R-squared) is then calculated
35+
/// the original values for all other features. The evaluation metric (e.g. R-squared) is then calculated
3636
/// for this modified dataset, and the change in the evaluation metric from the original dataset is computed.
3737
/// The larger the change in the evaluation metric, the more important the feature is to the model.
3838
/// PFI works by performing this permutation analysis across all the features of a model, one after another.
3939
/// </para>
4040
/// <para>
4141
/// In this implementation, PFI computes the change in all possible regression evaluation metrics for each feature, and an
42-
/// <code>ImmutableArray</code> of <code>RegressionMetrics</code> objects is returned. See the sample below for an
42+
/// <see cref="ImmutableArray"/> of <see cref="RegressionMetrics"/> objects is returned. See the sample below for an
4343
/// example of working with these results to analyze the feature importance of a model.
4444
/// </para>
4545
/// </remarks>
@@ -53,7 +53,7 @@ public static class PermutationFeatureImportanceExtensions
5353
/// <param name="catalog">The regression catalog.</param>
5454
/// <param name="predictionTransformer">The model on which to evaluate feature importance.</param>
5555
/// <param name="data">The evaluation data set.</param>
56-
/// <param name="labelColumnName">Label column name.</param>
56+
/// <param name="labelColumnName">Label column name. The column data must be <see cref="System.Single"/>.</param>
5757
/// <param name="useFeatureWeightFilter">Use features weight to pre-filter features.</param>
5858
/// <param name="numberOfExamplesToUse">Limit the number of examples to evaluate on. <cref langword="null"/> means up to ~2 bln examples from <paramref param="data"/> will be used.</param>
5959
/// <param name="permutationCount">The number of permutations to perform.</param>
@@ -95,7 +95,7 @@ private static RegressionMetrics RegressionDelta(
9595

9696
#region Binary Classification
9797
/// <summary>
98-
/// Permutation Feature Importance (PFI) for Binary Classification
98+
/// Permutation Feature Importance (PFI) for Binary Classification.
9999
/// </summary>
100100
/// <remarks>
101101
/// <para>
@@ -108,14 +108,14 @@ private static RegressionMetrics RegressionDelta(
108108
/// <para>
109109
/// PFI works by taking a labeled dataset, choosing a feature, and permuting the values
110110
/// for that feature across all the examples, so that each example now has a random value for the feature and
111-
/// the original values for all other features. The evalution metric (e.g. AUC) is then calculated
111+
/// the original values for all other features. The evaluation metric (e.g. AUC) is then calculated
112112
/// for this modified dataset, and the change in the evaluation metric from the original dataset is computed.
113113
/// The larger the change in the evaluation metric, the more important the feature is to the model.
114114
/// PFI works by performing this permutation analysis across all the features of a model, one after another.
115115
/// </para>
116116
/// <para>
117117
/// In this implementation, PFI computes the change in all possible binary classification evaluation metrics for each feature, and an
118-
/// <code>ImmutableArray</code> of <code>BinaryClassificationMetrics</code> objects is returned. See the sample below for an
118+
/// <see cref="ImmutableArray"/> of <see cref="BinaryClassificationMetrics"/> objects is returned. See the sample below for an
119119
/// example of working with these results to analyze the feature importance of a model.
120120
/// </para>
121121
/// </remarks>
@@ -129,7 +129,7 @@ private static RegressionMetrics RegressionDelta(
129129
/// <param name="catalog">The binary classification catalog.</param>
130130
/// <param name="predictionTransformer">The model on which to evaluate feature importance.</param>
131131
/// <param name="data">The evaluation data set.</param>
132-
/// <param name="labelColumnName">Label column name.</param>
132+
/// <param name="labelColumnName">Label column name. The column data must be <see cref="System.Boolean"/>.</param>
133133
/// <param name="useFeatureWeightFilter">Use features weight to pre-filter features.</param>
134134
/// <param name="numberOfExamplesToUse">Limit the number of examples to evaluate on. <cref langword="null"/> means up to ~2 bln examples from <paramref param="data"/> will be used.</param>
135135
/// <param name="permutationCount">The number of permutations to perform.</param>
@@ -175,7 +175,7 @@ private static BinaryClassificationMetrics BinaryClassifierDelta(
175175

176176
#region Multiclass Classification
177177
/// <summary>
178-
/// Permutation Feature Importance (PFI) for MulticlassClassification
178+
/// Permutation Feature Importance (PFI) for MulticlassClassification.
179179
/// </summary>
180180
/// <remarks>
181181
/// <para>
@@ -188,14 +188,14 @@ private static BinaryClassificationMetrics BinaryClassifierDelta(
188188
/// <para>
189189
/// PFI works by taking a labeled dataset, choosing a feature, and permuting the values
190190
/// for that feature across all the examples, so that each example now has a random value for the feature and
191-
/// the original values for all other features. The evalution metric (e.g. micro-accuracy) is then calculated
191+
/// the original values for all other features. The evaluation metric (e.g. micro-accuracy) is then calculated
192192
/// for this modified dataset, and the change in the evaluation metric from the original dataset is computed.
193193
/// The larger the change in the evaluation metric, the more important the feature is to the model.
194194
/// PFI works by performing this permutation analysis across all the features of a model, one after another.
195195
/// </para>
196196
/// <para>
197197
/// In this implementation, PFI computes the change in all possible multiclass classification evaluation metrics for each feature, and an
198-
/// <code>ImmutableArray</code> of <code>MulticlassClassificationMetrics</code> objects is returned. See the sample below for an
198+
/// <see cref="ImmutableArray"/> of <see cref="MulticlassClassificationMetrics"/> objects is returned. See the sample below for an
199199
/// example of working with these results to analyze the feature importance of a model.
200200
/// </para>
201201
/// </remarks>
@@ -209,7 +209,7 @@ private static BinaryClassificationMetrics BinaryClassifierDelta(
209209
/// <param name="catalog">The clustering catalog.</param>
210210
/// <param name="predictionTransformer">The model on which to evaluate feature importance.</param>
211211
/// <param name="data">The evaluation data set.</param>
212-
/// <param name="labelColumnName">Label column name.</param>
212+
/// <param name="labelColumnName">Label column name. The column data must be <see cref="KeyDataViewType"/>.</param>
213213
/// <param name="useFeatureWeightFilter">Use features weight to pre-filter features.</param>
214214
/// <param name="numberOfExamplesToUse">Limit the number of examples to evaluate on. <cref langword="null"/> means up to ~2 bln examples from <paramref param="data"/> will be used.</param>
215215
/// <param name="permutationCount">The number of permutations to perform.</param>
@@ -260,7 +260,7 @@ private static MulticlassClassificationMetrics MulticlassClassificationDelta(
260260

261261
#region Ranking
262262
/// <summary>
263-
/// Permutation Feature Importance (PFI) for Ranking
263+
/// Permutation Feature Importance (PFI) for Ranking.
264264
/// </summary>
265265
/// <remarks>
266266
/// <para>
@@ -273,14 +273,14 @@ private static MulticlassClassificationMetrics MulticlassClassificationDelta(
273273
/// <para>
274274
/// PFI works by taking a labeled dataset, choosing a feature, and permuting the values
275275
/// for that feature across all the examples, so that each example now has a random value for the feature and
276-
/// the original values for all other features. The evalution metric (e.g. NDCG) is then calculated
276+
/// the original values for all other features. The evaluation metric (e.g. NDCG) is then calculated
277277
/// for this modified dataset, and the change in the evaluation metric from the original dataset is computed.
278278
/// The larger the change in the evaluation metric, the more important the feature is to the model.
279279
/// PFI works by performing this permutation analysis across all the features of a model, one after another.
280280
/// </para>
281281
/// <para>
282282
/// In this implementation, PFI computes the change in all possible ranking evaluation metrics for each feature, and an
283-
/// <code>ImmutableArray</code> of <code>RankingMetrics</code> objects is returned. See the sample below for an
283+
/// <see cref="ImmutableArray"/> of <see cref="RankingMetrics"/> objects is returned. See the sample below for an
284284
/// example of working with these results to analyze the feature importance of a model.
285285
/// </para>
286286
/// </remarks>
@@ -294,7 +294,7 @@ private static MulticlassClassificationMetrics MulticlassClassificationDelta(
294294
/// <param name="catalog">The clustering catalog.</param>
295295
/// <param name="predictionTransformer">The model on which to evaluate feature importance.</param>
296296
/// <param name="data">The evaluation data set.</param>
297-
/// <param name="labelColumnName">Label column name.</param>
297+
/// <param name="labelColumnName">Label column name. The column data must be <see cref="System.Single"/> or <see cref="KeyDataViewType"/>.</param>
298298
/// <param name="rowGroupColumnName">GroupId column name</param>
299299
/// <param name="useFeatureWeightFilter">Use features weight to pre-filter features.</param>
300300
/// <param name="numberOfExamplesToUse">Limit the number of examples to evaluate on. <cref langword="null"/> means up to ~2 bln examples from <paramref param="data"/> will be used.</param>

0 commit comments

Comments
 (0)