-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fix column purpose for PipelineSweeperMacro #461
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
e1fa741
703cb38
c3c2125
17026a4
c76181c
28371fe
310b395
4fbaf14
3ca4da9
678d727
7f94a87
d55b1e0
c624415
d4f6102
99172e2
fb5ca79
6b34d71
3ad0c08
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -208,6 +208,7 @@ public sealed class AutoMlMlState : IMlState | |
| private TransformInference.SuggestedTransform[] _availableTransforms; | ||
| private RecipeInference.SuggestedRecipe.SuggestedLearner[] _availableLearners; | ||
| private DependencyMap _dependencyMapping; | ||
| private Dictionary<string, ColumnPurpose> _columnPurpose; | ||
| public IPipelineOptimizer AutoMlEngine { get; set; } | ||
| public PipelinePattern[] BatchCandidates { get; set; } | ||
| public SupportedMetric Metric { get; } | ||
|
|
@@ -370,19 +371,21 @@ private TransformInference.SuggestedTransform[] InferAndFilter(IDataView data, T | |
| TransformInference.SuggestedTransform[] existingTransforms = null) | ||
| { | ||
| // Infer transforms using experts | ||
| var levelTransforms = TransformInference.InferTransforms(_env, data, args); | ||
| var levelTransforms = TransformInference.InferTransforms(_env, data, args, this._columnPurpose); | ||
|
|
||
| // Retain only those transforms inferred which were also passed in. | ||
| if (existingTransforms != null) | ||
| return levelTransforms.Where(t => existingTransforms.Any(t2 => t2.Equals(t))).ToArray(); | ||
| return levelTransforms; | ||
| } | ||
|
|
||
| public void InferSearchSpace(int numTransformLevels) | ||
| public void InferSearchSpace(int numTransformLevels, Dictionary<string, ColumnPurpose> columnPurpose = null) | ||
| { | ||
| var learners = RecipeInference.AllowedLearners(_env, TrainerKind).ToArray(); | ||
| if (_requestedLearners != null && _requestedLearners.Length > 0) | ||
| learners = learners.Where(l => _requestedLearners.Contains(l.LearnerName)).ToArray(); | ||
|
|
||
| this._columnPurpose = columnPurpose; | ||
| ComputeSearchSpace(numTransformLevels, learners, (b, c) => InferAndFilter(b, c)); | ||
| } | ||
|
|
||
|
|
@@ -536,7 +539,26 @@ public PipelinePattern[] GetNextCandidates(int numberOfCandidates) | |
| var currentBatchSize = numberOfCandidates; | ||
| if (_terminator is IterationTerminator itr) | ||
| currentBatchSize = Math.Min(itr.RemainingIterations(_history), numberOfCandidates); | ||
| BatchCandidates = AutoMlEngine.GetNextCandidates(_sortedSampledElements.Select(kvp => kvp.Value), currentBatchSize); | ||
| BatchCandidates = AutoMlEngine.GetNextCandidates( | ||
| _sortedSampledElements.Select(kvp => kvp.Value), | ||
| currentBatchSize, | ||
| this._columnPurpose); | ||
|
|
||
| var h = _env.Register("AutoMlMlState"); | ||
|
||
| using (var ch = h.Start("GetNextCandidates")) | ||
|
||
| { | ||
| foreach (var pipeline in BatchCandidates) | ||
| { | ||
| ch.Info("AutoInference Suggested Transforms."); | ||
|
||
| int transformK = 0; | ||
| foreach (var transform in pipeline.Transforms) | ||
| { | ||
| transformK += 1; | ||
| ch.Info($"Transform {transformK} : {transform.Transform.ToString()}"); | ||
|
||
| } | ||
| } | ||
| } | ||
|
|
||
| return BatchCandidates; | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,12 +30,13 @@ public UniformRandomEngine(IHostEnvironment env) | |
| : base(env, env.Register("UniformRandomEngine(AutoML)")) | ||
| {} | ||
|
|
||
| public override PipelinePattern[] GetNextCandidates(IEnumerable<PipelinePattern> history, int numberOfCandidates) | ||
| public override PipelinePattern[] GetNextCandidates(IEnumerable<PipelinePattern> history, int numberOfCandidates, | ||
| Dictionary<string, ColumnPurpose> columnPurpose = null) | ||
|
||
| { | ||
| return GetRandomPipelines(numberOfCandidates); | ||
| return GetRandomPipelines(numberOfCandidates, columnPurpose); | ||
| } | ||
|
|
||
| private PipelinePattern[] GetRandomPipelines(int numOfPipelines) | ||
| private PipelinePattern[] GetRandomPipelines(int numOfPipelines, Dictionary<string, ColumnPurpose> columnPurpose = null) | ||
| { | ||
| Host.Check(AvailableLearners.All(l => l.PipelineNode != null)); | ||
| Host.Check(AvailableTransforms.All(t => t.PipelineNode != null)); | ||
|
|
@@ -66,7 +67,7 @@ private PipelinePattern[] GetRandomPipelines(int numOfPipelines) | |
|
|
||
| // Always include features concat transform | ||
| selectedTransforms.AddRange(AutoMlUtils.GetFinalFeatureConcat(Env, FullyTransformedData, | ||
| DependencyMapping, selectedTransforms.ToArray(), AvailableTransforms)); | ||
| DependencyMapping, selectedTransforms.ToArray(), AvailableTransforms, columnPurpose)); | ||
|
|
||
| // Compute hash key for checking if we've already seen this pipeline. | ||
| // However, if we keep missing, don't want to get stuck in infinite loop. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we tend to omit usage of "this" word. #Resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
In reply to: 199589164 [](ancestors = 199589164)