// local
        public static Pipeline GetPipeline(TaskKind task, IDataView data, string label)
        {
            var mlContext           = new MLContext();
            var availableTransforms = TransformInferenceApi.InferTransforms(mlContext, data, label);
            var availableTrainers   = RecipeInference.AllowedTrainers(mlContext, task, 1);
            var pipeline            = new InferredPipeline(availableTransforms, availableTrainers.First(), mlContext);

            return(pipeline.ToPipeline());
        }
        public static IEstimator <ITransformer> InferTransforms(this TransformsCatalog catalog, IDataView data, string label)
        {
            var mlContext           = new MLContext();
            var suggestedTransforms = TransformInferenceApi.InferTransforms(mlContext, data, label);
            var estimators          = suggestedTransforms.Select(s => s.Estimator);
            var pipeline            = new EstimatorChain <ITransformer>();

            foreach (var estimator in estimators)
            {
                pipeline = pipeline.Append(estimator);
            }
            return(pipeline);
        }
Esempio n. 3
0
        private void IteratePipelinesAndFit()
        {
            var stopwatch         = Stopwatch.StartNew();
            var transforms        = TransformInferenceApi.InferTransforms(_mlContext, _trainData, _label, _puproseOverrides);
            var availableTrainers = RecipeInference.AllowedTrainers(_mlContext, _task, _settings.StoppingCriteria.MaxIterations);

            do
            {
                // get next pipeline
                var pipeline = PipelineSuggester.GetNextPipeline(_history, transforms, availableTrainers, _optimizingMetricInfo.IsMaximizing);

                // break if no candidates returned, means no valid pipeline available
                if (pipeline == null)
                {
                    break;
                }

                // evaluate pipeline
                ProcessPipeline(pipeline);
            } while (_history.Count < _settings.StoppingCriteria.MaxIterations &&
                     stopwatch.Elapsed.TotalMinutes < _settings.StoppingCriteria.TimeOutInMinutes);
        }