Skip to content
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

[AutoML] If first three iterations all fail, short-circuit AutoML experiment #3591

Merged
merged 3 commits into from
Apr 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/Microsoft.ML.Auto/Experiment/Experiment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ public IList<TRunDetail> Execute()
break;
}

// If after third run, all runs have failed so far, throw exception
if (_history.Count() == 3 && _history.All(r => !r.RunSucceded))
{
throw new InvalidOperationException($"Training failed with the exception: {_history.Last().Exception}");
}

} while (_history.Count < _experimentSettings.MaxModels &&
!_experimentSettings.CancellationToken.IsCancellationRequested &&
stopwatch.Elapsed.TotalSeconds < _experimentSettings.MaxExperimentTimeInSeconds);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ internal SuggestedPipelineCrossValRunDetail(SuggestedPipeline pipeline,
IEnumerable<SuggestedPipelineTrainResult<TMetrics>> results) : base(pipeline, score, runSucceeded)
{
Results = results;
Exception = Results.Select(r => r.Exception).FirstOrDefault(e => e != null);
}

public CrossValidationRunDetail<TMetrics> ToIterationResult(IEstimator<ITransformer> preFeaturizer)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ internal class SuggestedPipelineRunDetail
public readonly bool RunSucceded;
public readonly double Score;

public Exception Exception { get; set; }

public SuggestedPipelineRunDetail(SuggestedPipeline pipeline, double score, bool runSucceeded)
{
Pipeline = pipeline;
Expand All @@ -34,7 +36,6 @@ internal class SuggestedPipelineRunDetail<TMetrics> : SuggestedPipelineRunDetail
{
public readonly TMetrics ValidationMetrics;
public readonly ModelContainer ModelContainer;
public readonly Exception Exception;

internal SuggestedPipelineRunDetail(SuggestedPipeline pipeline,
double score,
Expand Down