Skip to content

Commit 4748f03

Browse files
Use better AutiFit overload and ignore Multiclass (dotnet#64)
1 parent 312e267 commit 4748f03

File tree

1 file changed

+3
-19
lines changed

1 file changed

+3
-19
lines changed

src/mlnet/Commands/NewCommand.cs

+3-19
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,7 @@ private static (Pipeline, ITransformer) ExploreModels(
5858

5959
if (options.MlTask == TaskKind.BinaryClassification)
6060
{
61-
var result = context.BinaryClassification.AutoFit(trainData, label, validationData, settings:
62-
new AutoFitSettings()
63-
{
64-
StoppingCriteria = new ExperimentStoppingCriteria()
65-
{
66-
//default need to have a way to override
67-
TimeOutInMinutes = 10
68-
}
69-
});
61+
var result = context.BinaryClassification.AutoFit(trainData, label, validationData, 10);
7062
result = result.OrderByDescending(t => t.Metrics.Accuracy);
7163
var bestIteration = result.FirstOrDefault();
7264
pipelineToDeconstruct = bestIteration.Pipeline;
@@ -75,22 +67,14 @@ private static (Pipeline, ITransformer) ExploreModels(
7567

7668
if (options.MlTask == TaskKind.Regression)
7769
{
78-
var result = context.Regression.AutoFit(trainData, label, validationData, settings:
79-
new AutoFitSettings()
80-
{
81-
StoppingCriteria = new ExperimentStoppingCriteria()
82-
{
83-
//default need to have a way to override
84-
TimeOutInMinutes = 10
85-
}
86-
});
70+
var result = context.Regression.AutoFit(trainData, label, validationData, 10);
8771
result = result.OrderByDescending(t => t.Metrics.RSquared);
8872
var bestIteration = result.FirstOrDefault();
8973
pipelineToDeconstruct = bestIteration.Pipeline;
9074
model = bestIteration.Model;
9175
}
9276

93-
if (options.MlTask == TaskKind.Regression)
77+
if (options.MlTask == TaskKind.MulticlassClassification)
9478
{
9579
throw new NotImplementedException();
9680
}

0 commit comments

Comments
 (0)