Skip to content

Commit be2dbcb

Browse files
fix build error
1 parent fd85b74 commit be2dbcb

File tree

2 files changed

+57
-52
lines changed

2 files changed

+57
-52
lines changed

src/Microsoft.ML.AutoML/API/AutoCatalog.cs

Lines changed: 53 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,8 @@ public AutoMLExperiment CreateExperiment(AutoMLExperiment.AutoMLExperimentSettin
319319
/// <param name="fastTreeOption">if provided, use it as initial option for fast tree, otherwise the default option will be used.</param>
320320
/// <param name="lgbmOption">if provided, use it as initial option for lgbm, otherwise the default option will be used.</param>
321321
/// <param name="fastForestOption">if provided, use it as initial option for fast forest, otherwise the default option will be used.</param>
322-
/// <param name="lbfgsOption">if provided, use it as initial option for lbfgs, otherwise the default option will be used.</param>
323-
/// <param name="sdcaOption">if provided, use it as initial option for sdca, otherwise the default option will be used.</param>
322+
/// <param name="lbfgsLogisticRegressionOption">if provided, use it as initial option for <paramref name="lbfgsLogisticRegressionSearchSpace"/>, otherwise the default option will be used.</param>
323+
/// <param name="sdcaLogisticRegressionOption">if provided, use it as initial option for <paramref name="sdcaLogisticRegressionSearchSpace"/>, otherwise the default option will be used.</param>
324324
/// <param name="fastTreeSearchSpace">if provided, use it as search space for fast tree, otherwise the default search space will be used.</param>
325325
/// <param name="lgbmSearchSpace">if provided, use it as search space for lgbm, otherwise the default search space will be used.</param>
326326
/// <param name="fastForestSearchSpace">if provided, use it as search space for fast forest, otherwise the default search space will be used.</param>
@@ -338,8 +338,8 @@ public SweepablePipeline BinaryClassification(string labelColumnName = DefaultCo
338338
FastTreeOption fastTreeOption = null,
339339
LgbmOption lgbmOption = null,
340340
FastForestOption fastForestOption = null,
341-
LbfgsOption lbfgsOption = null,
342-
SdcaOption sdcaOption = null,
341+
LbfgsOption lbfgsLogisticRegressionOption = null,
342+
SdcaOption sdcaLogisticRegressionOption = null,
343343
SearchSpace<FastTreeOption> fastTreeSearchSpace = null,
344344
SearchSpace<LgbmOption> lgbmSearchSpace = null,
345345
SearchSpace<FastForestOption> fastForestSearchSpace = null,
@@ -377,20 +377,20 @@ public SweepablePipeline BinaryClassification(string labelColumnName = DefaultCo
377377

378378
if (useLbfgsLogisticRegression)
379379
{
380-
lbfgsOption = lbfgsOption ?? new LbfgsOption();
381-
lbfgsOption.LabelColumnName = labelColumnName;
382-
lbfgsOption.FeatureColumnName = featureColumnName;
383-
lbfgsOption.ExampleWeightColumnName = exampleWeightColumnName;
384-
res.Add(SweepableEstimatorFactory.CreateSdcaLogisticRegressionBinary(lbfgsOption, lbfgsSearchSpace ?? new SearchSpace<LbfgsOption>(lbfgsOption)));
380+
lbfgsLogisticRegressionOption = lbfgsLogisticRegressionOption ?? new LbfgsOption();
381+
lbfgsLogisticRegressionOption.LabelColumnName = labelColumnName;
382+
lbfgsLogisticRegressionOption.FeatureColumnName = featureColumnName;
383+
lbfgsLogisticRegressionOption.ExampleWeightColumnName = exampleWeightColumnName;
384+
res.Add(SweepableEstimatorFactory.CreateLbfgsPoissonRegressionRegression(lbfgsLogisticRegressionOption, lbfgsLogisticRegressionSearchSpace ?? new SearchSpace<LbfgsOption>(lbfgsLogisticRegressionOption)));
385385
}
386386

387387
if (useSdcaLogisticRegression)
388388
{
389-
sdcaOption = sdcaOption ?? new SdcaOption();
390-
sdcaOption.LabelColumnName = labelColumnName;
391-
sdcaOption.FeatureColumnName = featureColumnName;
392-
sdcaOption.ExampleWeightColumnName = exampleWeightColumnName;
393-
res.Add(SweepableEstimatorFactory.CreateSdcaLogisticRegressionBinary(sdcaOption, sdcaSearchSpace ?? new SearchSpace<SdcaOption>(sdcaOption)));
389+
sdcaLogisticRegressionOption = sdcaLogisticRegressionOption ?? new SdcaOption();
390+
sdcaLogisticRegressionOption.LabelColumnName = labelColumnName;
391+
sdcaLogisticRegressionOption.FeatureColumnName = featureColumnName;
392+
sdcaLogisticRegressionOption.ExampleWeightColumnName = exampleWeightColumnName;
393+
res.Add(SweepableEstimatorFactory.CreateSdcaLogisticRegressionBinary(sdcaLogisticRegressionOption, sdcaLogisticRegressionSearchSpace ?? new SearchSpace<SdcaOption>(sdcaLogisticRegressionOption)));
394394
}
395395

396396
return new SweepablePipeline().Append(res.ToArray());
@@ -412,15 +412,17 @@ public SweepablePipeline BinaryClassification(string labelColumnName = DefaultCo
412412
/// <param name="fastTreeOption">if provided, use it as initial option for fast tree, otherwise the default option will be used.</param>
413413
/// <param name="lgbmOption">if provided, use it as initial option for lgbm, otherwise the default option will be used.</param>
414414
/// <param name="fastForestOption">if provided, use it as initial option for fast forest, otherwise the default option will be used.</param>
415-
/// <param name="lbfgsOption">if provided, use it as initial option for lbfgs, otherwise the default option will be used.</param>
416-
/// <param name="sdcaOption">if provided, use it as initial option for sdca, otherwise the default option will be used.</param>
415+
/// <param name="lbfgsMaximumEntrophyOption">if provided, use it as initial option for <paramref name="lbfgsMaximumEntrophySearchSpace"/>, otherwise the default option will be used.</param>
416+
/// <param name="lbfgsLogisticRegressionOption">if provided, use it as initial option for <paramref name="lbfgsLogisticRegressionSearchSpace"/>, otherwise the default option will be used.</param>
417+
/// <param name="sdcaMaximumEntrophyOption">if provided, use it as initial option for <paramref name="sdcaMaximumEntorphySearchSpace"/>, otherwise the default option will be used.</param>
418+
/// <param name="sdcaLogisticRegressionOption">if provided, use it as initial option for <paramref name="sdcaLogisticRegressionSearchSpace"/>, otherwise the default option will be used.</param>
417419
/// <param name="fastTreeSearchSpace">if provided, use it as search space for fast tree, otherwise the default search space will be used.</param>
418420
/// <param name="lgbmSearchSpace">if provided, use it as search space for lgbm, otherwise the default search space will be used.</param>
419421
/// <param name="fastForestSearchSpace">if provided, use it as search space for fast forest, otherwise the default search space will be used.</param>
420422
/// <param name="lbfgsMaximumEntrophySearchSpace">if provided, use it as search space for <see cref="LbfgsMaximumEntropyMulticlassTrainer"/>, otherwise the default search space will be used.</param>
421-
/// <param name="lbfgsLogisticRegressionSearchSpace">if provided, use it as search space for <see cref="LbfgsLogisticRegressionBinaryTrainer"/>, otherwise the default search space will be used.</param>
423+
/// <param name="lbfgsLogisticRegressionSearchSpace">if provided, use it as search space for <see cref="LbfgsMaximumEntropyMulticlassTrainer"/>, otherwise the default search space will be used.</param>
422424
/// <param name="sdcaMaximumEntorphySearchSpace">if provided, use it as search space for <see cref="SdcaMaximumEntropyMulti"/>, otherwise the default search space will be used.</param>
423-
/// <param name="sdcaMaximumEntorphySearchSpace">if provided, use it as search space for <see cref="SdcaLogisticRegressionBinaryTrainer"/>, otherwise the default search space will be used.</param>
425+
/// <param name="sdcaLogisticRegressionSearchSpace">if provided, use it as search space for <see cref="SdcaLogisticRegressionBinaryTrainer"/>, otherwise the default search space will be used.</param>
424426
/// <returns></returns>
425427
public SweepablePipeline MultiClassification(
426428
string labelColumnName = DefaultColumnNames.Label,
@@ -436,8 +438,10 @@ public SweepablePipeline MultiClassification(
436438
FastTreeOption fastTreeOption = null,
437439
LgbmOption lgbmOption = null,
438440
FastForestOption fastForestOption = null,
439-
LbfgsOption lbfgsOption = null,
440-
SdcaOption sdcaOption = null,
441+
LbfgsOption lbfgsMaximumEntrophyOption = null,
442+
LbfgsOption lbfgsLogisticRegressionOption = null,
443+
SdcaOption sdcaMaximumEntrophyOption = null,
444+
SdcaOption sdcaLogisticRegressionOption = null,
441445
SearchSpace<FastTreeOption> fastTreeSearchSpace = null,
442446
SearchSpace<LgbmOption> lgbmSearchSpace = null,
443447
SearchSpace<FastForestOption> fastForestSearchSpace = null,
@@ -477,38 +481,38 @@ public SweepablePipeline MultiClassification(
477481

478482
if (useLbfgsMaximumEntrophy)
479483
{
480-
lbfgsOption = lbfgsOption ?? new LbfgsOption();
481-
lbfgsOption.LabelColumnName = labelColumnName;
482-
lbfgsOption.FeatureColumnName = featureColumnName;
483-
lbfgsOption.ExampleWeightColumnName = exampleWeightColumnName;
484-
res.Add(SweepableEstimatorFactory.CreateLbfgsMaximumEntropyMulti(lbfgsOption, lbfgsMaximumEntrophySearchSpace ?? new SearchSpace<LbfgsOption>(lbfgsOption)));
484+
lbfgsMaximumEntrophyOption = lbfgsMaximumEntrophyOption ?? new LbfgsOption();
485+
lbfgsMaximumEntrophyOption.LabelColumnName = labelColumnName;
486+
lbfgsMaximumEntrophyOption.FeatureColumnName = featureColumnName;
487+
lbfgsMaximumEntrophyOption.ExampleWeightColumnName = exampleWeightColumnName;
488+
res.Add(SweepableEstimatorFactory.CreateLbfgsMaximumEntropyMulti(lbfgsMaximumEntrophyOption, lbfgsMaximumEntrophySearchSpace ?? new SearchSpace<LbfgsOption>(lbfgsMaximumEntrophyOption)));
485489
}
486490

487491
if (useLbfgsLogisticRegression)
488492
{
489-
lbfgsOption = lbfgsOption ?? new LbfgsOption();
490-
lbfgsOption.LabelColumnName = labelColumnName;
491-
lbfgsOption.FeatureColumnName = featureColumnName;
492-
lbfgsOption.ExampleWeightColumnName = exampleWeightColumnName;
493-
res.Add(SweepableEstimatorFactory.CreateLbfgsLogisticRegressionOva(lbfgsOption, lbfgsLogisticRegressionSearchSpace ?? new SearchSpace<LbfgsOption>(lbfgsOption)));
493+
lbfgsLogisticRegressionOption = lbfgsLogisticRegressionOption ?? new LbfgsOption();
494+
lbfgsLogisticRegressionOption.LabelColumnName = labelColumnName;
495+
lbfgsLogisticRegressionOption.FeatureColumnName = featureColumnName;
496+
lbfgsLogisticRegressionOption.ExampleWeightColumnName = exampleWeightColumnName;
497+
res.Add(SweepableEstimatorFactory.CreateLbfgsLogisticRegressionOva(lbfgsLogisticRegressionOption, lbfgsLogisticRegressionSearchSpace ?? new SearchSpace<LbfgsOption>(lbfgsLogisticRegressionOption)));
494498
}
495499

496500
if (useSdcaMaximumEntrophy)
497501
{
498-
sdcaOption = sdcaOption ?? new SdcaOption();
499-
sdcaOption.LabelColumnName = labelColumnName;
500-
sdcaOption.FeatureColumnName = featureColumnName;
501-
sdcaOption.ExampleWeightColumnName = exampleWeightColumnName;
502-
res.Add(SweepableEstimatorFactory.CreateSdcaMaximumEntropyMulti(sdcaOption, sdcaMaximumEntorphySearchSpace ?? new SearchSpace<SdcaOption>(sdcaOption)));
502+
sdcaMaximumEntrophyOption = sdcaMaximumEntrophyOption ?? new SdcaOption();
503+
sdcaMaximumEntrophyOption.LabelColumnName = labelColumnName;
504+
sdcaMaximumEntrophyOption.FeatureColumnName = featureColumnName;
505+
sdcaMaximumEntrophyOption.ExampleWeightColumnName = exampleWeightColumnName;
506+
res.Add(SweepableEstimatorFactory.CreateSdcaMaximumEntropyMulti(sdcaMaximumEntrophyOption, sdcaMaximumEntorphySearchSpace ?? new SearchSpace<SdcaOption>(sdcaMaximumEntrophyOption)));
503507
}
504508

505509
if (useSdcaLogisticRegression)
506510
{
507-
sdcaOption = sdcaOption ?? new SdcaOption();
508-
sdcaOption.LabelColumnName = labelColumnName;
509-
sdcaOption.FeatureColumnName = featureColumnName;
510-
sdcaOption.ExampleWeightColumnName = exampleWeightColumnName;
511-
res.Add(SweepableEstimatorFactory.CreateSdcaLogisticRegressionOva(sdcaOption, sdcaLogisticRegressionSearchSpace ?? new SearchSpace<SdcaOption>(sdcaOption)));
511+
sdcaLogisticRegressionOption = sdcaLogisticRegressionOption ?? new SdcaOption();
512+
sdcaLogisticRegressionOption.LabelColumnName = labelColumnName;
513+
sdcaLogisticRegressionOption.FeatureColumnName = featureColumnName;
514+
sdcaLogisticRegressionOption.ExampleWeightColumnName = exampleWeightColumnName;
515+
res.Add(SweepableEstimatorFactory.CreateSdcaLogisticRegressionOva(sdcaLogisticRegressionOption, sdcaLogisticRegressionSearchSpace ?? new SearchSpace<SdcaOption>(sdcaLogisticRegressionOption)));
512516
}
513517

514518
return new SweepablePipeline().Append(res.ToArray());
@@ -524,11 +528,12 @@ public SweepablePipeline MultiClassification(
524528
/// <param name="useLgbm">true if use lgbm as available trainer.</param>
525529
/// <param name="useFastTree">true if use fast tree as available trainer.</param>
526530
/// <param name="useLbfgsPoissonRegression">true if use <see cref="LbfgsPoissonRegressionTrainer"/> as available trainer.</param>
531+
/// <param name="useSdca">true if use <see cref="SdcaRegressionTrainer"/> as available trainer.</param>
527532
/// <param name="fastTreeOption">if provided, use it as initial option for fast tree, otherwise the default option will be used.</param>
528533
/// <param name="lgbmOption">if provided, use it as initial option for lgbm, otherwise the default option will be used.</param>
529534
/// <param name="fastForestOption">if provided, use it as initial option for fast forest, otherwise the default option will be used.</param>
530-
/// <param name="lbfgsOption">if provided, use it as initial option for lbfgs, otherwise the default option will be used.</param>
531-
/// <param name="sdcaOption">if provided, use it as initial option for sdca, otherwise the default option will be used.</param>
535+
/// <param name="lbfgsPoissonRegressionOption">if provided, use it as initial option for <paramref name="lbfgsPoissonRegressionSearchSpace"/>, otherwise the default option will be used.</param>
536+
/// <param name="sdcaOption">if provided, use it as initial option for <paramref name="sdcaSearchSpace"/>, otherwise the default option will be used.</param>
532537
/// <param name="fastTreeSearchSpace">if provided, use it as search space for fast tree, otherwise the default search space will be used.</param>
533538
/// <param name="lgbmSearchSpace">if provided, use it as search space for lgbm, otherwise the default search space will be used.</param>
534539
/// <param name="fastForestSearchSpace">if provided, use it as search space for fast forest, otherwise the default search space will be used.</param>
@@ -547,7 +552,7 @@ public SweepablePipeline Regression(
547552
FastTreeOption fastTreeOption = null,
548553
LgbmOption lgbmOption = null,
549554
FastForestOption fastForestOption = null,
550-
LbfgsOption lbfgsOption = null,
555+
LbfgsOption lbfgsPoissonRegressionOption = null,
551556
SdcaOption sdcaOption = null,
552557
SearchSpace<FastTreeOption> fastTreeSearchSpace = null,
553558
SearchSpace<LgbmOption> lgbmSearchSpace = null,
@@ -586,11 +591,11 @@ public SweepablePipeline Regression(
586591

587592
if (useLbfgsPoissonRegression)
588593
{
589-
lbfgsOption = lbfgsOption ?? new LbfgsOption();
590-
lbfgsOption.LabelColumnName = labelColumnName;
591-
lbfgsOption.FeatureColumnName = featureColumnName;
592-
lbfgsOption.ExampleWeightColumnName = exampleWeightColumnName;
593-
res.Add(SweepableEstimatorFactory.CreateLbfgsPoissonRegressionRegression(lbfgsOption, lbfgsPoissonRegressionSearchSpace ?? new SearchSpace<LbfgsOption>(lbfgsOption)));
594+
lbfgsPoissonRegressionOption = lbfgsPoissonRegressionOption ?? new LbfgsOption();
595+
lbfgsPoissonRegressionOption.LabelColumnName = labelColumnName;
596+
lbfgsPoissonRegressionOption.FeatureColumnName = featureColumnName;
597+
lbfgsPoissonRegressionOption.ExampleWeightColumnName = exampleWeightColumnName;
598+
res.Add(SweepableEstimatorFactory.CreateLbfgsPoissonRegressionRegression(lbfgsPoissonRegressionOption, lbfgsPoissonRegressionSearchSpace ?? new SearchSpace<LbfgsOption>(lbfgsPoissonRegressionOption)));
594599
}
595600

596601
if (useSdca)

test/Microsoft.ML.AutoML.Tests/AutoMLExperimentTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ public async Task AutoMLExperiment_UCI_Adult_Train_Test_Split_Test()
212212
var data = DatasetUtil.GetUciAdultDataView();
213213
var experiment = context.Auto().CreateExperiment();
214214
var pipeline = context.Auto().Featurizer(data, "_Features_", excludeColumns: new[] { DatasetUtil.UciAdultLabel })
215-
.Append(context.Auto().BinaryClassification(DatasetUtil.UciAdultLabel, "_Features_", useLgbm: false, useSdca: false, useLbfgs: false));
215+
.Append(context.Auto().BinaryClassification(DatasetUtil.UciAdultLabel, "_Features_", useLgbm: false, useSdcaLogisticRegression: false, useLbfgsLogisticRegression: false));
216216

217217
experiment.SetDataset(context.Data.TrainTestSplit(data))
218218
.SetBinaryClassificationMetric(BinaryClassificationMetric.AreaUnderRocCurve, DatasetUtil.UciAdultLabel)
@@ -237,7 +237,7 @@ public async Task AutoMLExperiment_UCI_Adult_CV_5_Test()
237237
var data = DatasetUtil.GetUciAdultDataView();
238238
var experiment = context.Auto().CreateExperiment();
239239
var pipeline = context.Auto().Featurizer(data, "_Features_", excludeColumns: new[] { DatasetUtil.UciAdultLabel })
240-
.Append(context.Auto().BinaryClassification(DatasetUtil.UciAdultLabel, "_Features_", useLgbm: false, useSdca: false, useLbfgs: false));
240+
.Append(context.Auto().BinaryClassification(DatasetUtil.UciAdultLabel, "_Features_", useLgbm: false, useSdcaLogisticRegression: false, useLbfgsLogisticRegression: false));
241241

242242
experiment.SetDataset(data, 5)
243243
.SetBinaryClassificationMetric(BinaryClassificationMetric.AreaUnderRocCurve, DatasetUtil.UciAdultLabel)
@@ -318,7 +318,7 @@ public async Task AutoMLExperiment_Taxi_Fare_Train_Test_Split_Test()
318318
var experiment = context.Auto().CreateExperiment();
319319
var label = DatasetUtil.TaxiFareLabel;
320320
var pipeline = context.Auto().Featurizer(train, excludeColumns: new[] { label })
321-
.Append(context.Auto().Regression(label, useLgbm: false, useSdca: false, useLbfgs: false));
321+
.Append(context.Auto().Regression(label, useLgbm: false, useSdca: false, useLbfgsPoissonRegression: false));
322322

323323
experiment.SetDataset(train, test)
324324
.SetRegressionMetric(RegressionMetric.RSquared, label)
@@ -337,7 +337,7 @@ public async Task AutoMLExperiment_Taxi_Fare_CV_5_Test()
337337
var experiment = context.Auto().CreateExperiment();
338338
var label = DatasetUtil.TaxiFareLabel;
339339
var pipeline = context.Auto().Featurizer(train, excludeColumns: new[] { label })
340-
.Append(context.Auto().Regression(label, useLgbm: false, useSdca: false, useLbfgs: false));
340+
.Append(context.Auto().Regression(label, useLgbm: false, useSdca: false, useLbfgsPoissonRegression: false));
341341

342342
experiment.SetDataset(train, 5)
343343
.SetRegressionMetric(RegressionMetric.RSquared, label)

0 commit comments

Comments
 (0)