Skip to content

Scrubbing OneVsAll #2743

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 1, 2019
Merged

Scrubbing OneVsAll #2743

merged 1 commit into from
Mar 1, 2019

Conversation

singlis
Copy link
Member

@singlis singlis commented Feb 26, 2019

@singlis singlis self-assigned this Feb 26, 2019
@codecov
Copy link

codecov bot commented Feb 26, 2019

Codecov Report

Merging #2743 into master will decrease coverage by <.01%.
The diff coverage is 70%.

@@            Coverage Diff             @@
##           master    #2743      +/-   ##
==========================================
- Coverage   71.67%   71.67%   -0.01%     
==========================================
  Files         809      809              
  Lines      142416   142416              
  Branches    16120    16120              
==========================================
- Hits       102077   102073       -4     
- Misses      35909    35911       +2     
- Partials     4430     4432       +2
Flag Coverage Δ
#Debug 71.67% <70%> (-0.01%) ⬇️
#production 67.91% <76.47%> (-0.01%) ⬇️
#test 85.86% <33.33%> (ø) ⬆️
Impacted Files Coverage Δ
...ft.ML.StandardLearners/Standard/MultiClass/Pkpd.cs 88.23% <ø> (ø) ⬆️
...rners/Standard/MultiClass/MetaMulticlassTrainer.cs 86.31% <ø> (ø) ⬆️
...ML.LightGBM.StaticPipe/LightGbmStaticExtensions.cs 46.42% <ø> (ø) ⬆️
test/Microsoft.ML.Benchmarks/Numeric/Ranking.cs 0% <0%> (ø) ⬆️
...oft.ML.Benchmarks/Text/MultiClassClassification.cs 0% <0%> (ø) ⬆️
...est/Microsoft.ML.StaticPipelineTesting/Training.cs 99.25% <100%> (ø) ⬆️
...Microsoft.ML.LightGBM/LightGbmMulticlassTrainer.cs 87.94% <100%> (ø) ⬆️
...oft.ML.StandardLearners/StandardLearnersCatalog.cs 88.57% <100%> (ø) ⬆️
src/Microsoft.ML.EntryPoints/ModelOperations.cs 100% <100%> (ø) ⬆️
...earners/Standard/MultiClass/OneVersusAllTrainer.cs 74.17% <66.66%> (ø)
... and 4 more

@Ivanidzo4ka
Copy link
Contributor

Ivanidzo4ka commented Feb 26, 2019

        IEstimator<ISingleFeaturePredictionTransformer<ICalibrator>> calibrator = null,

@wschin do we have any plans to do something about this one? #Resolved


Refers to: src/Microsoft.ML.StandardLearners/StandardLearnersCatalog.cs:597 in 24ecdcc. [](commit_id = 24ecdcc, deletion_comment = False)

@artidoro
Copy link
Contributor

artidoro commented Feb 26, 2019

// The .NET Foundation licenses this file to you under the MIT license.

Could you also rename the file? #Resolved


Refers to: src/Microsoft.ML.StandardLearners/Standard/MultiClass/Ova.cs:2 in 24ecdcc. [](commit_id = 24ecdcc, deletion_comment = False)

@singlis
Copy link
Member Author

singlis commented Feb 26, 2019

// The .NET Foundation licenses this file to you under the MIT license.

yes.


In reply to: 467612026 [](ancestors = 467612026)


Refers to: src/Microsoft.ML.StandardLearners/Standard/MultiClass/Ova.cs:2 in 24ecdcc. [](commit_id = 24ecdcc, deletion_comment = False)

@wschin
Copy link
Member

wschin commented Feb 27, 2019

IEstimator<ISingleFeaturePredictionTransformer> calibrator = null,

@wschin do we have any plans to do something about this one?

Refers to: src/Microsoft.ML.StandardLearners/StandardLearnersCatalog.cs:597 in 24ecdcc. [](commit_id = 24ecdcc, deletion_comment = False)

This doesn't look very good to me but my assignment for fixing that is postponed. #Resolved

@@ -20,7 +20,7 @@ public abstract class MetaMulticlassTrainer<TTransformer, TModel> : ITrainerEsti
where TTransformer : ISingleFeaturePredictionTransformer<TModel>
where TModel : class
{
public abstract class OptionsBase
internal abstract class OptionsBase
Copy link
Member

@wschin wschin Feb 28, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we internalize an Options of a trainer? #Resolved

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is internal because the only class that derives from it, Options for pkpd and ova are both internal.

The option classes are internal because there are no advanced options and all of the arguments are exposed in the argument-based constructor.


In reply to: 261015420 [](ancestors = 261015420)

/// </summary>
/// <param name="env">The <see cref="IHostEnvironment"/> instance.</param>
/// <param name="binaryEstimator">An instance of a binary <see cref="ITrainerEstimator{TTransformer, TPredictor}"/> used as the base trainer.</param>
/// <param name="calibrator">The calibrator. If a calibrator is not explicitely provided, it will default to <see cref="PlattCalibratorTrainer"/></param>
/// <param name="calibrator">The calibrator. If a calibrator is not provided, it will default to <see cref="PlattCalibratorTrainer"/></param>
Copy link
Member

@wschin wschin Feb 28, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does a naturally-calibrated model (say, logistic regression) interact with this parameter? #Resolved

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont know for sure - I will posted an issue as a question. #2805


In reply to: 261015949 [](ancestors = 261015949)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also I think it would be worth updating this comment once I have more info. I won't that block checking this in for now though.


In reply to: 261430492 [](ancestors = 261430492,261015949)

/// <param name="labelColumn">The name of the label colum.</param>
/// <param name="imputeMissingLabelsAsNegative">Whether to treat missing labels as having negative labels, instead of keeping them missing.</param>
/// <param name="imputeMissingLabelsAsNegative">If true will treat missing labels as negative labels.</param>
/// <param name="maxCalibrationExamples">Number of instances to train the calibrator.</param>
Copy link
Member

@wschin wschin Feb 28, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// <param name="maxCalibrationExamples">Number of instances to train the calibrator.</param>
/// <param name="maximumCalibrationExampleCount">Number of instances to train the calibrator.</param>

What's the indent scope of this PR? Inferred from its title, I assume that having better argument names is included. Please correct me if I am wrong. #Resolved

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better argument names is in scope for this PR.


In reply to: 261016830 [](ancestors = 261016830)

/// <param name="maxCalibrationExamples">Number of instances to train the calibrator.</param>
/// <param name="useProbabilities">Use probabilities (vs. raw outputs) to identify top-score category.</param>
internal Ova(IHostEnvironment env,
internal OneVersusAllTrainer(IHostEnvironment env,
TScalarTrainer binaryEstimator,
string labelColumn = DefaultColumnNames.Label,
Copy link
Member

@wschin wschin Feb 28, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
string labelColumn = DefaultColumnNames.Label,
string labelColumnName = DefaultColumnNames.Label,
``` #Resolved

/// </summary>
/// <param name="env">The <see cref="IHostEnvironment"/> instance.</param>
/// <param name="binaryEstimator">An instance of a binary <see cref="ITrainerEstimator{TTransformer, TPredictor}"/> used as the base trainer.</param>
/// <param name="calibrator">The calibrator. If a calibrator is not explicitely provided, it will default to <see cref="PlattCalibratorTrainer"/></param>
/// <param name="calibrator">The calibrator. If a calibrator is not provided, it will default to <see cref="PlattCalibratorTrainer"/></param>
/// <param name="labelColumn">The name of the label colum.</param>
Copy link
Member

@wschin wschin Feb 28, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// <param name="labelColumn">The name of the label colum.</param>
/// <param name="labelColumnName">The name of the label colum.</param>
``` #Resolved

@@ -50,7 +50,7 @@ namespace Microsoft.ML.Trainers
/// logistic regression is a more principled way to solve a multiclass problem, it
/// requires that the learner store a lot more intermediate state in the form of
/// L-BFGS history for all classes *simultaneously*, rather than just one-by-one
/// as would be needed for OVA.
/// as would be needed for OneVersusAll.
Copy link
Member

@wschin wschin Feb 28, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OneVersusAll [](start = 31, length = 12)

Please use see cref= if you mean a class or just one-versus-all classification model otherwise. #Resolved

@wschin
Copy link
Member

wschin commented Feb 28, 2019

        int maxCalibrationExamples = 1000000000,

maxCalibrationExampleCount #Resolved


Refers to: src/Microsoft.ML.StandardLearners/Standard/MultiClass/Ova.cs:90 in 5093549. [](commit_id = 5093549, deletion_comment = False)

@@ -49,7 +49,7 @@ public sealed class Ova : MetaMulticlassTrainer<MulticlassPredictionTransformer<
private readonly Options _options;

/// <summary>
/// Options passed to OVA.
/// Options passed to OneVsAll.
Copy link
Member

@wschin wschin Feb 28, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do see cref= here. #Resolved

@singlis
Copy link
Member Author

singlis commented Feb 28, 2019

        int maxCalibrationExamples = 1000000000,

good catch - I think this should be maximumCalibrationExampleCount


In reply to: 468101653 [](ancestors = 468101653)


Refers to: src/Microsoft.ML.StandardLearners/Standard/MultiClass/Ova.cs:90 in 5093549. [](commit_id = 5093549, deletion_comment = False)

Copy link
Member

@wschin wschin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM. Btw, instead of min/max we use minimum/maximum in argument names.

@@ -15,7 +15,7 @@
<GoogleProtobufPackageVersion>3.5.1</GoogleProtobufPackageVersion>
<LightGBMPackageVersion>2.2.3</LightGBMPackageVersion>
<MicrosoftMLOnnxRuntimePackageVersion>0.2.1</MicrosoftMLOnnxRuntimePackageVersion>
<MlNetMklDepsPackageVersion>0.0.0.7</MlNetMklDepsPackageVersion>
<MlNetMklDepsPackageVersion>0.0.0.8</MlNetMklDepsPackageVersion>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ugh! I merged a branch. Will revert these changes..

- Renamed OVA to OneVersusAllTrainer
- Renames to abbreviated arguments
- Updates to comments and documentation

Related to dotnet#2619
@singlis singlis merged commit 2b417bb into dotnet:master Mar 1, 2019
@singlis singlis deleted the singlis/ova branch March 7, 2019 00:53
@ghost ghost locked as resolved and limited conversation to collaborators Mar 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants