public static SuggestedPipeline FromPipeline(MLContext context, Pipeline pipeline) { var transforms = new List <SuggestedTransform>(); var transformsPostTrainer = new List <SuggestedTransform>(); SuggestedTrainer trainer = null; var trainerEncountered = false; foreach (var pipelineNode in pipeline.Nodes) { if (pipelineNode.NodeType == PipelineNodeType.Trainer) { var trainerName = (TrainerName)Enum.Parse(typeof(TrainerName), pipelineNode.Name); var trainerExtension = TrainerExtensionCatalog.GetTrainerExtension(trainerName); var hyperParamSet = TrainerExtensionUtil.BuildParameterSet(trainerName, pipelineNode.Properties); var columnInfo = TrainerExtensionUtil.BuildColumnInfo(pipelineNode.Properties); trainer = new SuggestedTrainer(context, trainerExtension, columnInfo, hyperParamSet); trainerEncountered = true; } else if (pipelineNode.NodeType == PipelineNodeType.Transform) { var estimatorName = (EstimatorName)Enum.Parse(typeof(EstimatorName), pipelineNode.Name); var estimatorExtension = EstimatorExtensionCatalog.GetExtension(estimatorName); var estimator = estimatorExtension.CreateInstance(context, pipelineNode); var transform = new SuggestedTransform(pipelineNode, estimator); if (!trainerEncountered) { transforms.Add(transform); } else { transformsPostTrainer.Add(transform); } } } return(new SuggestedPipeline(transforms, transformsPostTrainer, trainer, context, pipeline.CacheBeforeTrainer)); }