...
/Solution Review: Configuring a Custom AutoML Monitor
Solution Review: Configuring a Custom AutoML Monitor
Review the solution of applying a custom monitor in AutoML.
We'll cover the following...
The complete solution is available in the following playground:
using Microsoft.ML.AutoML; namespace AutoMlCustomMonitor; internal class CustomMonitor : IMonitor { private readonly SweepablePipeline _pipeline; private readonly IEnumerable<TrialResult> _completedTrials; public CustomMonitor(SweepablePipeline pipeline) { _pipeline = pipeline; _completedTrials = new List<TrialResult>(); } public IEnumerable<TrialResult> GetCompletedTrials() => _completedTrials; public void ReportBestTrial(TrialResult result) { var trialId = result.TrialSettings.TrialId; var timeToTrain = result.DurationInMilliseconds; var pipeline = _pipeline.ToString(result.TrialSettings.Parameter); Console.WriteLine($"The best trial is {trialId}. Finished training in {timeToTrain}ms with pipeline {pipeline}"); } public void ReportCompletedTrial(TrialResult result) { var trialId = result.TrialSettings.TrialId; var timeToTrain = result.DurationInMilliseconds; var pipeline = _pipeline.ToString(result.TrialSettings.Parameter); Console.WriteLine($"Trial {trialId} finished training in {timeToTrain}ms with pipeline {pipeline}"); } public void ReportFailTrial(TrialSettings settings, Exception exception = null) { if (exception.Message.Contains("Operation was canceled.")) { Console.WriteLine($"{settings.TrialId} cancelled. Time budget exceeded."); } Console.WriteLine($"{settings.TrialId} failed with exception {exception.Message}"); } public void ReportRunningTrial(TrialSettings setting) { return; } }
The complete solution with an improved AutoML monitor
Solving the challenge
Here are the steps we take to complete specific ...