Exemplo n.º 1
0
            public PipelinePattern[] GetNextCandidates(int numberOfCandidates)
            {
                if (_terminator.ShouldTerminate(_history))
                {
                    return new PipelinePattern[] { }
                }
                ;
                var currentBatchSize = numberOfCandidates;

                if (_terminator is IterationTerminator itr)
                {
                    currentBatchSize = Math.Min(itr.RemainingIterations(_history), numberOfCandidates);
                }
                BatchCandidates = AutoMlEngine.GetNextCandidates(_sortedSampledElements.Select(kvp => kvp.Value), currentBatchSize, _dataRoles);

                using (var ch = _host.Start("Suggested Pipeline"))
                {
                    foreach (var pipeline in BatchCandidates)
                    {
                        ch.Info($"AutoInference Pipeline Id : {pipeline.UniqueId}");
                        foreach (var transform in pipeline.Transforms)
                        {
                            ch.Info($"AutoInference Transform : {transform.Transform}");
                        }
                        ch.Info($"AutoInference Learner : {pipeline.Learner}");
                    }
                }

                return(BatchCandidates);
            }
            public PipelinePattern[] GetNextCandidates(int numberOfCandidates)
            {
                if (_terminator.ShouldTerminate(_history))
                {
                    return new PipelinePattern[] { }
                }
                ;
                var currentBatchSize = numberOfCandidates;

                if (_terminator is IterationTerminator itr)
                {
                    currentBatchSize = Math.Min(itr.RemainingIterations(_history), numberOfCandidates);
                }
                BatchCandidates = AutoMlEngine.GetNextCandidates(_sortedSampledElements.Select(kvp => kvp.Value), currentBatchSize);
                return(BatchCandidates);
            }
            private void MainLearningLoop(int batchSize, int numOfTrainingRows)
            {
                var stopwatch        = new Stopwatch();
                var probabilityUtils = new Sweeper.Algorithms.SweeperProbabilityUtils(_host);

                while (!_terminator.ShouldTerminate(_history))
                {
                    // Get next set of candidates
                    var currentBatchSize = batchSize;
                    if (_terminator is IterationTerminator itr)
                    {
                        currentBatchSize = Math.Min(itr.RemainingIterations(_history), batchSize);
                    }
                    var candidates = AutoMlEngine.GetNextCandidates(_sortedSampledElements.Values, currentBatchSize);

                    // Break if no candidates returned, means no valid pipeline available.
                    if (candidates.Length == 0)
                    {
                        break;
                    }

                    // Evaluate them on subset of data
                    foreach (var candidate in candidates)
                    {
                        try
                        {
                            ProcessPipeline(probabilityUtils, stopwatch, candidate, numOfTrainingRows);
                        }
                        catch (Exception)
                        {
                            stopwatch.Stop();
                            return;
                        }
                    }
                }
            }