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