PermutationFeatureImportance( this RankingCatalog catalog, ITransformer model, IDataView data, string labelColumnName = DefaultColumnNames.Label, string rowGroupColumnName = DefaultColumnNames.GroupId, 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)); RankingMetricsStatistics resultInitializer() => new(); RankingMetrics evaluationFunc(IDataView idv) => catalog.Evaluate(idv, labelColumnName, rowGroupColumnName); return(PermutationFeatureImportance( env, model, data, resultInitializer, evaluationFunc, RankingDelta, permutationCount, useFeatureWeightFilter, numberOfExamplesToUse )); }
/// <summary> /// Create the ML context. /// </summary> /// <param name="seed">Random seed. Set to <c>null</c> for a non-deterministic environment.</param> /// <param name="conc">Concurrency level. Set to 1 to run single-threaded. Set to 0 to pick automatically.</param> public MLContext(int?seed = null, int conc = 0) { _env = new LocalEnvironment(seed, conc, MakeCompositionContainer); _env.AddListener(ProcessMessage); BinaryClassification = new BinaryClassificationCatalog(_env); MulticlassClassification = new MulticlassClassificationCatalog(_env); Regression = new RegressionCatalog(_env); Clustering = new ClusteringCatalog(_env); Ranking = new RankingCatalog(_env); Transforms = new TransformsCatalog(_env); Model = new ModelOperationsCatalog(_env); Data = new DataOperationsCatalog(_env); }
/// <summary> /// Create the ML context. /// </summary> /// <param name="seed">Random seed. Set to <c>null</c> for a non-deterministic environment.</param> public MLContext(int?seed = null) { _env = new LocalEnvironment(seed); _env.AddListener(ProcessMessage); BinaryClassification = new BinaryClassificationCatalog(_env); MulticlassClassification = new MulticlassClassificationCatalog(_env); Regression = new RegressionCatalog(_env); Clustering = new ClusteringCatalog(_env); Ranking = new RankingCatalog(_env); AnomalyDetection = new AnomalyDetectionCatalog(_env); Transforms = new TransformsCatalog(_env); Model = new ModelOperationsCatalog(_env); Data = new DataOperationsCatalog(_env); }
PermutationFeatureImportance <TModel>( this RankingCatalog catalog, IPredictionTransformer <TModel> model, IDataView data, string label = DefaultColumnNames.Label, string groupId = DefaultColumnNames.GroupId, string features = DefaultColumnNames.Features, bool useFeatureWeightFilter = false, int?topExamples = null, int permutationCount = 1) { return(PermutationFeatureImportance <TModel, RankingMetrics, RankingMetricsStatistics> .GetImportanceMetricsMatrix( catalog.GetEnvironment(), model, data, idv => catalog.Evaluate(idv, label, groupId), RankingDelta, features, permutationCount, useFeatureWeightFilter, topExamples)); }
PermutationFeatureImportance <TModel>( this RankingCatalog catalog, ISingleFeaturePredictionTransformer <TModel> predictionTransformer, IDataView data, string labelColumnName = DefaultColumnNames.Label, string rowGroupColumnName = DefaultColumnNames.GroupId, bool useFeatureWeightFilter = false, int?numberOfExamplesToUse = null, int permutationCount = 1) where TModel : class { return(PermutationFeatureImportance <TModel, RankingMetrics, RankingMetricsStatistics> .GetImportanceMetricsMatrix( catalog.GetEnvironment(), predictionTransformer, data, () => new RankingMetricsStatistics(), idv => catalog.Evaluate(idv, labelColumnName, rowGroupColumnName), RankingDelta, predictionTransformer.FeatureColumnName, permutationCount, useFeatureWeightFilter, numberOfExamplesToUse)); }
internal RankingTrainers(RankingCatalog catalog) : base(catalog) { }