From 295cc85f681171add1a180657bb88e4f671831b1 Mon Sep 17 00:00:00 2001 From: Letticia Nicoli Date: Mon, 27 Jul 2020 21:03:34 -0300 Subject: [PATCH 1/3] Replace whitelist terminology to allow list --- src/Microsoft.ML.AutoML/API/ExperimentBase.cs | 10 +++++----- src/Microsoft.ML.AutoML/Experiment/Experiment.cs | 8 ++++---- src/Microsoft.ML.AutoML/Experiment/RecipeInference.cs | 4 ++-- .../PipelineSuggesters/PipelineSuggester.cs | 4 ++-- .../TrainerExtensions/TrainerExtensionCatalog.cs | 8 ++++---- .../Text/TextFeaturizingEstimator.cs | 2 +- .../Common/EntryPoints/core_manifest.json | 2 +- .../TrainerExtensionsTests.cs | 10 +++++----- 8 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/Microsoft.ML.AutoML/API/ExperimentBase.cs b/src/Microsoft.ML.AutoML/API/ExperimentBase.cs index d8b4523f88..d3e4eb295b 100644 --- a/src/Microsoft.ML.AutoML/API/ExperimentBase.cs +++ b/src/Microsoft.ML.AutoML/API/ExperimentBase.cs @@ -26,14 +26,14 @@ public abstract class ExperimentBase private readonly IChannel _logger; private readonly TaskKind _task; - private readonly IEnumerable _trainerWhitelist; + private readonly IEnumerable _trainerAllowList; internal ExperimentBase(MLContext context, IMetricsAgent metricsAgent, OptimizingMetricInfo optimizingMetricInfo, TExperimentSettings settings, TaskKind task, - IEnumerable trainerWhitelist) + IEnumerable trainerAllowList) { Context = context; MetricsAgent = metricsAgent; @@ -41,7 +41,7 @@ internal ExperimentBase(MLContext context, Settings = settings; _logger = ((IChannelProvider)context).Start("AutoML"); _task = task; - _trainerWhitelist = trainerWhitelist; + _trainerAllowList = trainerAllowList; } /// @@ -312,7 +312,7 @@ private CrossValidationExperimentResult ExecuteCrossVal(IDataView[] tr // Execute experiment & get all pipelines run var experiment = new Experiment, TMetrics>(Context, _task, OptimizingMetricInfo, progressHandler, - Settings, MetricsAgent, _trainerWhitelist, columns, runner, _logger); + Settings, MetricsAgent, _trainerAllowList, columns, runner, _logger); var runDetails = experiment.Execute(); var bestRun = GetBestCrossValRun(runDetails); @@ -347,7 +347,7 @@ private ExperimentResult Execute(ColumnInformation columnInfo, { // Execute experiment & get all pipelines run var experiment = new Experiment, TMetrics>(Context, _task, OptimizingMetricInfo, progressHandler, - Settings, MetricsAgent, _trainerWhitelist, columns, runner, _logger); + Settings, MetricsAgent, _trainerAllowList, columns, runner, _logger); var runDetails = experiment.Execute(); var bestRun = GetBestRun(runDetails); diff --git a/src/Microsoft.ML.AutoML/Experiment/Experiment.cs b/src/Microsoft.ML.AutoML/Experiment/Experiment.cs index 07c0c73964..c845dca14f 100644 --- a/src/Microsoft.ML.AutoML/Experiment/Experiment.cs +++ b/src/Microsoft.ML.AutoML/Experiment/Experiment.cs @@ -19,7 +19,7 @@ internal class Experiment where TRunDetail : RunDetail private readonly IProgress _progressCallback; private readonly ExperimentSettings _experimentSettings; private readonly IMetricsAgent _metricsAgent; - private readonly IEnumerable _trainerWhitelist; + private readonly IEnumerable _trainerAllowList; private readonly DirectoryInfo _modelDirectory; private readonly DatasetColumnInfo[] _datasetColumnInfo; private readonly IRunner _runner; @@ -32,7 +32,7 @@ public Experiment(MLContext context, IProgress progressCallback, ExperimentSettings experimentSettings, IMetricsAgent metricsAgent, - IEnumerable trainerWhitelist, + IEnumerable trainerAllowList, DatasetColumnInfo[] datasetColumnInfo, IRunner runner, IChannel logger) @@ -44,7 +44,7 @@ public Experiment(MLContext context, _progressCallback = progressCallback; _experimentSettings = experimentSettings; _metricsAgent = metricsAgent; - _trainerWhitelist = trainerWhitelist; + _trainerAllowList = trainerAllowList; _modelDirectory = GetModelDirectory(_experimentSettings.CacheDirectory); _datasetColumnInfo = datasetColumnInfo; _runner = runner; @@ -63,7 +63,7 @@ public IList Execute() // get next pipeline var getPipelineStopwatch = Stopwatch.StartNew(); var pipeline = PipelineSuggester.GetNextInferredPipeline(_context, _history, _datasetColumnInfo, _task, - _optimizingMetricInfo.IsMaximizing, _experimentSettings.CacheBeforeTrainer, _trainerWhitelist); + _optimizingMetricInfo.IsMaximizing, _experimentSettings.CacheBeforeTrainer, _trainerAllowList); var pipelineInferenceTimeInSeconds = getPipelineStopwatch.Elapsed.TotalSeconds; diff --git a/src/Microsoft.ML.AutoML/Experiment/RecipeInference.cs b/src/Microsoft.ML.AutoML/Experiment/RecipeInference.cs index b4918b8ff4..059359ecd6 100644 --- a/src/Microsoft.ML.AutoML/Experiment/RecipeInference.cs +++ b/src/Microsoft.ML.AutoML/Experiment/RecipeInference.cs @@ -13,9 +13,9 @@ internal static class RecipeInference /// /// Array of viable learners. public static IEnumerable AllowedTrainers(MLContext mlContext, TaskKind task, - ColumnInformation columnInfo, IEnumerable trainerWhitelist) + ColumnInformation columnInfo, IEnumerable trainerAllowList) { - var trainerExtensions = TrainerExtensionCatalog.GetTrainers(task, trainerWhitelist, columnInfo); + var trainerExtensions = TrainerExtensionCatalog.GetTrainers(task, trainerAllowList, columnInfo); var trainers = new List(); foreach (var trainerExtension in trainerExtensions) diff --git a/src/Microsoft.ML.AutoML/PipelineSuggesters/PipelineSuggester.cs b/src/Microsoft.ML.AutoML/PipelineSuggesters/PipelineSuggester.cs index 8adbeb8f42..8a420cbb5d 100644 --- a/src/Microsoft.ML.AutoML/PipelineSuggesters/PipelineSuggester.cs +++ b/src/Microsoft.ML.AutoML/PipelineSuggesters/PipelineSuggester.cs @@ -30,10 +30,10 @@ public static SuggestedPipeline GetNextInferredPipeline(MLContext context, TaskKind task, bool isMaximizingMetric, CacheBeforeTrainer cacheBeforeTrainer, - IEnumerable trainerWhitelist = null) + IEnumerable trainerAllowList = null) { var availableTrainers = RecipeInference.AllowedTrainers(context, task, - ColumnInformationUtil.BuildColumnInfo(columns), trainerWhitelist); + ColumnInformationUtil.BuildColumnInfo(columns), trainerAllowList); var transforms = TransformInferenceApi.InferTransforms(context, task, columns).ToList(); var transformsPostTrainer = TransformInferenceApi.InferTransformsPostTrainer(context, task, columns).ToList(); diff --git a/src/Microsoft.ML.AutoML/TrainerExtensions/TrainerExtensionCatalog.cs b/src/Microsoft.ML.AutoML/TrainerExtensions/TrainerExtensionCatalog.cs index 8378c67144..c568cbde78 100644 --- a/src/Microsoft.ML.AutoML/TrainerExtensions/TrainerExtensionCatalog.cs +++ b/src/Microsoft.ML.AutoML/TrainerExtensions/TrainerExtensionCatalog.cs @@ -61,7 +61,7 @@ public static ITrainerExtension GetTrainerExtension(TrainerName trainerName) } public static IEnumerable GetTrainers(TaskKind task, - IEnumerable whitelist, ColumnInformation columnInfo) + IEnumerable allowList, ColumnInformation columnInfo) { IEnumerable trainers; if (task == TaskKind.BinaryClassification) @@ -101,10 +101,10 @@ public static IEnumerable GetTrainers(TaskKind task, throw new NotSupportedException($"unsupported machine learning task type {task}"); } - if (whitelist != null) + if (allowList != null) { - whitelist = new HashSet(whitelist); - trainers = trainers.Where(t => whitelist.Contains(GetTrainerName(t))); + allowList = new HashSet(allowList); + trainers = trainers.Where(t => allowList.Contains(GetTrainerName(t))); } return trainers; diff --git a/src/Microsoft.ML.Transforms/Text/TextFeaturizingEstimator.cs b/src/Microsoft.ML.Transforms/Text/TextFeaturizingEstimator.cs index e09142dc09..0d1fb5d3aa 100644 --- a/src/Microsoft.ML.Transforms/Text/TextFeaturizingEstimator.cs +++ b/src/Microsoft.ML.Transforms/Text/TextFeaturizingEstimator.cs @@ -195,7 +195,7 @@ public IStopWordsRemoverOptions StopWordsRemoverOptions [Argument(ArgumentType.AtMostOnce, HelpText = "Column containing the transformed text tokens.", ShortName = "tokens,showtext,showTransformedText", SortOrder = 9)] public string OutputTokensColumnName; - [Argument(ArgumentType.Multiple, HelpText = "A dictionary of whitelisted terms.", ShortName = "dict", NullName = "", SortOrder = 10, Hide = true)] + [Argument(ArgumentType.Multiple, HelpText = "A dictionary of allow listed terms.", ShortName = "dict", NullName = "", SortOrder = 10, Hide = true)] internal TermLoaderArguments Dictionary; [TGUI(Label = "Word Gram Extractor")] diff --git a/test/BaselineOutput/Common/EntryPoints/core_manifest.json b/test/BaselineOutput/Common/EntryPoints/core_manifest.json index 21977eb293..4e011c7586 100644 --- a/test/BaselineOutput/Common/EntryPoints/core_manifest.json +++ b/test/BaselineOutput/Common/EntryPoints/core_manifest.json @@ -23843,7 +23843,7 @@ } ] }, - "Desc": "A dictionary of whitelisted terms.", + "Desc": "A dictionary of allow listed terms.", "Aliases": [ "dict" ], diff --git a/test/Microsoft.ML.AutoML.Tests/TrainerExtensionsTests.cs b/test/Microsoft.ML.AutoML.Tests/TrainerExtensionsTests.cs index afe17fc048..87e060ddd5 100644 --- a/test/Microsoft.ML.AutoML.Tests/TrainerExtensionsTests.cs +++ b/test/Microsoft.ML.AutoML.Tests/TrainerExtensionsTests.cs @@ -399,18 +399,18 @@ public void PublicToPrivateTrainerNamesNullTest() } [Fact] - public void AllowedTrainersWhitelistNullTest() + public void AllowedTrainersAllowListNullTest() { var trainers = RecipeInference.AllowedTrainers(new MLContext(1), TaskKind.BinaryClassification, new ColumnInformation(), null); Assert.True(trainers.Any()); } [Fact] - public void AllowedTrainersWhitelistTest() + public void AllowedTrainersAllowListTest() { - var whitelist = new[] { TrainerName.AveragedPerceptronBinary, TrainerName.FastForestBinary }; - var trainers = RecipeInference.AllowedTrainers(new MLContext(1), TaskKind.BinaryClassification, new ColumnInformation(), whitelist); - Assert.Equal(whitelist.Count(), trainers.Count()); + var allowList = new[] { TrainerName.AveragedPerceptronBinary, TrainerName.FastForestBinary }; + var trainers = RecipeInference.AllowedTrainers(new MLContext(1), TaskKind.BinaryClassification, new ColumnInformation(), allowList); + Assert.Equal(allowList.Count(), trainers.Count()); } } } From 76987ee82654fecc354460649b8aeaa1ebda67ed Mon Sep 17 00:00:00 2001 From: Letticia Nicoli Date: Mon, 27 Jul 2020 21:25:39 -0300 Subject: [PATCH 2/3] Change allow listed terms to allowed terms Co-authored-by: Sam Harwell --- src/Microsoft.ML.Transforms/Text/TextFeaturizingEstimator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.ML.Transforms/Text/TextFeaturizingEstimator.cs b/src/Microsoft.ML.Transforms/Text/TextFeaturizingEstimator.cs index 0d1fb5d3aa..c601b469a0 100644 --- a/src/Microsoft.ML.Transforms/Text/TextFeaturizingEstimator.cs +++ b/src/Microsoft.ML.Transforms/Text/TextFeaturizingEstimator.cs @@ -195,7 +195,7 @@ public IStopWordsRemoverOptions StopWordsRemoverOptions [Argument(ArgumentType.AtMostOnce, HelpText = "Column containing the transformed text tokens.", ShortName = "tokens,showtext,showTransformedText", SortOrder = 9)] public string OutputTokensColumnName; - [Argument(ArgumentType.Multiple, HelpText = "A dictionary of allow listed terms.", ShortName = "dict", NullName = "", SortOrder = 10, Hide = true)] + [Argument(ArgumentType.Multiple, HelpText = "A dictionary of allowed terms.", ShortName = "dict", NullName = "", SortOrder = 10, Hide = true)] internal TermLoaderArguments Dictionary; [TGUI(Label = "Word Gram Extractor")] From 413cdc6d7a6d91c9c68c6b1a93ffe19f3cd782e9 Mon Sep 17 00:00:00 2001 From: Letticia Nicoli Date: Mon, 27 Jul 2020 21:27:07 -0300 Subject: [PATCH 3/3] Change allow listed terms to allowed terms for core manifest Co-authored-by: Sam Harwell --- test/BaselineOutput/Common/EntryPoints/core_manifest.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/BaselineOutput/Common/EntryPoints/core_manifest.json b/test/BaselineOutput/Common/EntryPoints/core_manifest.json index 4e011c7586..ba9cffb88a 100644 --- a/test/BaselineOutput/Common/EntryPoints/core_manifest.json +++ b/test/BaselineOutput/Common/EntryPoints/core_manifest.json @@ -23843,7 +23843,7 @@ } ] }, - "Desc": "A dictionary of allow listed terms.", + "Desc": "A dictionary of allowed terms.", "Aliases": [ "dict" ], @@ -30844,4 +30844,4 @@ ] } ] -} \ No newline at end of file +}