PermutationFeatureImportance( this MulticlassClassificationCatalog catalog, ITransformer model, IDataView data, string labelColumnName = DefaultColumnNames.Label, bool useFeatureWeightFilter = false, int?numberOfExamplesToUse = null, int permutationCount = 1) { Contracts.CheckValue(catalog, nameof(catalog)); var env = catalog.GetEnvironment(); Contracts.CheckValue(env, nameof(env)); env.CheckValue(data, nameof(data)); env.CheckValue(model, nameof(model)); MulticlassClassificationMetricsStatistics resultInitializer() => new(); MulticlassClassificationMetrics evaluationFunc(IDataView idv) => catalog.Evaluate(idv, labelColumnName); return(PermutationFeatureImportance( env, model, data, resultInitializer, evaluationFunc, MulticlassClassificationDelta, permutationCount, useFeatureWeightFilter, numberOfExamplesToUse )); }
PermutationFeatureImportance <TModel>( this MulticlassClassificationCatalog catalog, IPredictionTransformer <TModel> model, IDataView data, string label = DefaultColumnNames.Label, string features = DefaultColumnNames.Features, bool useFeatureWeightFilter = false, int?topExamples = null, int permutationCount = 1) { return(PermutationFeatureImportance <TModel, MultiClassClassifierMetrics, MultiClassClassifierMetricsStatistics> .GetImportanceMetricsMatrix( catalog.GetEnvironment(), model, data, idv => catalog.Evaluate(idv, label), MulticlassClassificationDelta, features, permutationCount, useFeatureWeightFilter, topExamples)); }
PermutationFeatureImportance <TModel>( this MulticlassClassificationCatalog catalog, ISingleFeaturePredictionTransformer <TModel> predictionTransformer, IDataView data, string labelColumnName = DefaultColumnNames.Label, bool useFeatureWeightFilter = false, int?numberOfExamplesToUse = null, int permutationCount = 1) where TModel : class { return(PermutationFeatureImportance <TModel, MulticlassClassificationMetrics, MulticlassClassificationMetricsStatistics> .GetImportanceMetricsMatrix( catalog.GetEnvironment(), predictionTransformer, data, () => new MulticlassClassificationMetricsStatistics(), idv => catalog.Evaluate(idv, labelColumnName), MulticlassClassificationDelta, predictionTransformer.FeatureColumnName, permutationCount, useFeatureWeightFilter, numberOfExamplesToUse)); }