Skip to content

Commit

Permalink
Add loadable attribute for LinearMulticlassModelParameters (#3217)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivanidzo4ka authored Apr 5, 2019
1 parent 68640bb commit 7e0cc46
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
"Multiclass LR Executor",
MaximumEntropyModelParameters.LoaderSignature)]

[assembly: LoadableClass(typeof(LinearMulticlassModelParameters), null, typeof(SignatureLoadModel),
"Multiclass LR No Calib",
LinearMulticlassModelParameters.LoaderSignature)]

[assembly: LoadableClass(typeof(void), typeof(LbfgsMaximumEntropyMulticlassTrainer), null, typeof(SignatureEntryPointModule), LbfgsMaximumEntropyMulticlassTrainer.LoadNameValue)]

namespace Microsoft.ML.Trainers
Expand Down
7 changes: 5 additions & 2 deletions test/Microsoft.ML.Tests/TrainerEstimators/SdcaTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ public void SdcaWorkout()

var data = TextLoaderStatic.CreateLoader(Env, ctx => (Label: ctx.LoadFloat(0), Features: ctx.LoadFloat(1, 10)))
.Load(dataPath).Cache();

var binaryData = ML.Transforms.Conversion.ConvertType("Label", outputKind: DataKind.Boolean)
.Fit(data.AsDynamic).Transform(data.AsDynamic);

Expand All @@ -36,11 +35,15 @@ public void SdcaWorkout()

TestEstimatorCore(regressionTrainer, data.AsDynamic);
var mcData = ML.Transforms.Conversion.MapValueToKey("Label").Fit(data.AsDynamic).Transform(data.AsDynamic);

var mcTrainer = ML.MulticlassClassification.Trainers.SdcaMaximumEntropy(
new SdcaMaximumEntropyMulticlassTrainer.Options { ConvergenceTolerance = 1e-2f, MaximumNumberOfIterations = 10 });
TestEstimatorCore(mcTrainer, mcData);

var mcTrainerNonCalibrated = ML.MulticlassClassification.Trainers.SdcaNonCalibrated(
new SdcaNonCalibratedMulticlassTrainer.Options { ConvergenceTolerance = 1e-2f, MaximumNumberOfIterations = 10 });
TestEstimatorCore(mcTrainerNonCalibrated, mcData);

Done();
}

Expand Down

0 comments on commit 7e0cc46

Please sign in to comment.