public void AutoPipeline_should_create_sdca_maximum_entropy_classifier_with_custom_option() { var context = new MLContext(); var option = new CustomSdcaMaximumEntropyOptionBuilder(); var trainer = context.AutoML().MultiClassification.SdcaMaximumEntropy("label", "feature", option); var parameterValues = option.SweepableValueGenerators.Select(x => x.CreateFromNormalized(0.5)); var parameterset = new Parameters(parameterValues); Approvals.Verify(trainer.ToCodeGenNodeContract(parameterset)); }
public void AutoPipeline_should_create_classifier_with_custom_factory() { var context = new MLContext(); var optionBuilder = new CustomSdcaMaximumEntropyOptionBuilder(); var trainer = context.AutoML().CreateSweepableEstimator( (context, option) => { option.LabelColumnName = "Label"; option.FeatureColumnName = "Features"; return(context.MulticlassClassification.Trainers.SdcaMaximumEntropy(option)); }, optionBuilder, new string[] { "Features" }, new string[] { "Score" }, "CustomSdca"); var parameterValues = optionBuilder.SweepableValueGenerators.Select(x => x.CreateFromNormalized(0.5)); var parameterset = new Parameters(parameterValues); Approvals.Verify(trainer.ToCodeGenNodeContract(parameterset)); }