コード例 #1
0
        internal (string, string[]) GenerateTrainerAndUsings()
        {
            if (_pipeline == null)
            {
                throw new ArgumentNullException(nameof(_pipeline));
            }
            var node = _pipeline.Nodes.Where(t => t.NodeType == PipelineNodeType.Trainer).First();
            ITrainerGenerator generator = TrainerGeneratorFactory.GetInstance(node);
            var trainerString           = generator.GenerateTrainer();
            var trainerUsings           = generator.GenerateUsings();

            return(trainerString, trainerUsings);
        }
コード例 #2
0
            public override string GenerateTrainer()
            {
                StringBuilder sb = new StringBuilder();

                sb.Append(MethodName);
                sb.Append("(");
                sb.Append("mlContext.BinaryClassification.Trainers."); // This is dependent on the name of the MLContext object in template.
                var trainerGenerator = TrainerGeneratorFactory.GetInstance((PipelineNode)_node.Properties["BinaryTrainer"]);

                _binaryTrainerUsings = trainerGenerator.GenerateUsings();
                sb.Append(trainerGenerator.GenerateTrainer());
                sb.Append(",");
                sb.Append("labelColumnName:");
                sb.Append("\"");
                sb.Append(_node.Properties["LabelColumnName"]);
                sb.Append("\"");
                sb.Append(")");
                return(sb.ToString());
            }