Skip to content

In the public surface area, all occurrences of Argument keyword replaced with Options #2563

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 8 commits into from
Feb 16, 2019

Conversation

abgoswam
Copy link
Member

Fixes #2557

For public API surface, all occurrences of Argument keyword replaced with Options

Several internal classes continue to be called Arguments. We can target those post V1.0 since they are not part of public surface area anyway.

@@ -49,7 +49,7 @@ internal static class FastTreeShared
public abstract class FastTreeTrainerBase<TArgs, TTransformer, TModel> :
TrainerEstimatorBaseWithGroupId<TTransformer, TModel>
where TTransformer : ISingleFeaturePredictionTransformer<TModel>
where TArgs : TreeArgs, new()
where TArgs : TreeOptions, new()
Copy link
Contributor

@Ivanidzo4ka Ivanidzo4ka Feb 15, 2019

Choose a reason for hiding this comment

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

TArgs [](start = 14, length = 5)

TOptions #Resolved

@@ -49,7 +49,7 @@ internal static class FastTreeShared
public abstract class FastTreeTrainerBase<TArgs, TTransformer, TModel> :
TrainerEstimatorBaseWithGroupId<TTransformer, TModel>
where TTransformer : ISingleFeaturePredictionTransformer<TModel>
where TArgs : TreeArgs, new()
where TArgs : TreeOptions, new()
where TModel : class
{
protected readonly TArgs Args;
Copy link
Contributor

@Ivanidzo4ka Ivanidzo4ka Feb 15, 2019

Choose a reason for hiding this comment

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

TArgs Args [](start = 27, length = 10)

TOptions Options; #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.

Options cause compile errors because of conflict with class Options. Renamed to FastTreeTrainerOptions


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

float l2RegularizerWeight = AveragedLinearArguments.AveragedDefaultArgs.L2RegularizerWeight,
int numIterations = AveragedLinearArguments.AveragedDefaultArgs.NumIterations)
float learningRate = AveragedLinearOptions.AveragedDefaultArgs.LearningRate,
bool decreaseLearningRate = AveragedLinearOptions.AveragedDefaultArgs.DecreaseLearningRate,
Copy link
Contributor

@Ivanidzo4ka Ivanidzo4ka Feb 15, 2019

Choose a reason for hiding this comment

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

AveragedDefaultArgs [](start = 62, length = 19)

Would rename to AveragedDefaults same for base class for this class. Just remove Arg. #Resolved

@codecov
Copy link

codecov bot commented Feb 15, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@3456bb3). Click here to learn what that means.
The diff coverage is 70.09%.

@@            Coverage Diff            @@
##             master    #2563   +/-   ##
=========================================
  Coverage          ?    71.5%           
=========================================
  Files             ?      801           
  Lines             ?   142036           
  Branches          ?    16151           
=========================================
  Hits              ?   101558           
  Misses            ?    36005           
  Partials          ?     4473
Flag Coverage Δ
#Debug 71.5% <70.09%> (?)
#production 67.78% <65.62%> (?)
#test 85.56% <96.1%> (?)

@@ -62,7 +62,7 @@ public abstract class ArgumentsBase { }
}
}

internal EarlyStoppingCriterion(TArguments args, bool lowerIsBetter)
internal EarlyStoppingCriterion(TOptions args, bool lowerIsBetter)
Copy link
Contributor

@artidoro artidoro Feb 15, 2019

Choose a reason for hiding this comment

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

args [](start = 49, length = 4)

Could you rename the local variable names as well? Here and in the rest of the file? #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.

fixed.

fyi.. in this PR the focus is scrubbing the public surface area for Options options .

There are still lots of internal occurrences of Arguments args .. Those are P2 since they can be renamed post V1.0 as well


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

@@ -176,7 +176,7 @@ public sealed class Arguments : ISupportSdcaClassificationLossFactory, ISupportC
private const Float Threshold = 0.5f;
private readonly Float _margin;

internal HingeLoss(Arguments args)
internal HingeLoss(Options args)
Copy link
Contributor

@artidoro artidoro Feb 15, 2019

Choose a reason for hiding this comment

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

args [](start = 35, length = 4)

Same here, I guess this is a comment that applies to all the files where you rename Arguments to Options. #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.

fixed.

fyi.. in this PR the focus is scrubbing the public surface area for Options options .

There are still lots of internal occurrences of Arguments args .. Those are P2 since they can be renamed post V1.0 as well


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

@Ivanidzo4ka
Copy link
Contributor

Ivanidzo4ka commented Feb 15, 2019

    public class ArgumentsCore

I believe this one would be handled by @artidoro PR #Resolved


Refers to: src/Microsoft.ML.Data/DataLoadSave/Text/TextLoader.cs:336 in e9409ca. [](commit_id = e9409ca, deletion_comment = False)

@abgoswam
Copy link
Member Author

    public class ArgumentsCore

@artidoro could you kindly confirm (want to make sure things do not slip through the cracks)


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


Refers to: src/Microsoft.ML.Data/DataLoadSave/Text/TextLoader.cs:336 in e9409ca. [](commit_id = e9409ca, deletion_comment = False)

@artidoro
Copy link
Contributor

artidoro commented Feb 15, 2019

Yes I am merging the two classes Arguments and ArgumentsCore into a single Options class. #Resolved

@artidoro
Copy link
Contributor

    public class ArgumentsCore

Sorry the github comment went under discussion. I am taking care of this in my other PR.


In reply to: 464209630 [](ancestors = 464209630,464199502)


Refers to: src/Microsoft.ML.Data/DataLoadSave/Text/TextLoader.cs:336 in e9409ca. [](commit_id = e9409ca, deletion_comment = False)

Copy link
Contributor

@Ivanidzo4ka Ivanidzo4ka left a comment

Choose a reason for hiding this comment

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

:shipit:

@@ -89,7 +89,7 @@ protected bool CheckBestScore(Float score)
public sealed class TolerantEarlyStoppingCriterion : EarlyStoppingCriterion<TolerantEarlyStoppingCriterion.Arguments>
{
[TlcModule.Component(FriendlyName = "Tolerant (TR)", Name = "TR", Desc = "Stop if validation score exceeds threshold value.")]
public class Arguments : ArgumentsBase, IEarlyStoppingCriterionFactory
public class Arguments : OptionsBase, IEarlyStoppingCriterionFactory
Copy link
Contributor

@artidoro artidoro Feb 15, 2019

Choose a reason for hiding this comment

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

Arguments [](start = 21, length = 9)

Could you rename this to Options? #Resolved

@@ -126,7 +126,7 @@ public override bool CheckScore(Float validationScore, Float trainingScore, out

public abstract class MovingWindowEarlyStoppingCriterion : EarlyStoppingCriterion<MovingWindowEarlyStoppingCriterion.Arguments>
{
public class Arguments : ArgumentsBase
public class Arguments : OptionsBase
Copy link
Contributor

@artidoro artidoro Feb 15, 2019

Choose a reason for hiding this comment

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

Arguments [](start = 21, length = 9)

Same here #Resolved

@@ -33,7 +33,7 @@ private static VersionInfo GetVersionInfo()
loaderAssemblyName: typeof(MultiVoting).Assembly.FullName);
}

private sealed class Arguments : ArgumentsBase
Copy link
Contributor

@artidoro artidoro Feb 15, 2019

Choose a reason for hiding this comment

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

Arguments [](start = 29, length = 9)

Even if it's private would be good to rename this one too. #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 am not touching the private ones in this PR.. (i think i mentioned this in my reply to the other comment)


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

@artidoro
Copy link
Contributor

artidoro commented Feb 15, 2019

    public sealed class Arguments : ArgumentsBase

Could you rename here too? Just for consistency but it's not public again. #Resolved


Refers to: src/Microsoft.ML.Ensemble/Trainer/Multiclass/MulticlassDataPartitionEnsembleTrainer.cs:39 in e9409ca. [](commit_id = e9409ca, deletion_comment = False)

@abgoswam
Copy link
Member Author

abgoswam commented Feb 15, 2019

    public sealed class Arguments : ArgumentsBase

maybe in a separate PR . as discussed first priority is to scrub public surface first.


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


Refers to: src/Microsoft.ML.Ensemble/Trainer/Multiclass/MulticlassDataPartitionEnsembleTrainer.cs:39 in e9409ca. [](commit_id = e9409ca, deletion_comment = False)

@abgoswam
Copy link
Member Author

    public class ArgumentsCore

ok. sounds good


In reply to: 464212892 [](ancestors = 464212892,464209630,464199502)


Refers to: src/Microsoft.ML.Data/DataLoadSave/Text/TextLoader.cs:336 in e9409ca. [](commit_id = e9409ca, deletion_comment = False)

@abgoswam
Copy link
Member Author

ok cool. i will keep it as-is in for now


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

@artidoro
Copy link
Contributor

artidoro commented Feb 15, 2019

The current changes look good! As mentioned in person, I think we should use the tool to get a list of all the objects in the public surface of ML.NET and see if any of them includes Arguments or Args in their name. Until we do that it is hard to determine whether we have truly gotten rid of them.

If you could run the tool and provide an output file that we can review, it would be extremely useful and we could actually consider this task as being done.

In the meantime let's check in this PR and avoid more conflicts. #Resolved

@artidoro
Copy link
Contributor

artidoro commented Feb 15, 2019

Please do address the few renaming suggestions I made for public classes. #Resolved

@abgoswam
Copy link
Member Author

Sure. i have taken care of the open comments.


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

@abgoswam
Copy link
Member Author

Sure. I will run a sanity check with the tool, so we know we have caught all of them. Till then I will keep issue open.

Thanks for the suggestion.


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

@abgoswam abgoswam merged commit 1f90f50 into dotnet:master Feb 16, 2019
@abgoswam
Copy link
Member Author

Thanks folks for the review comments!

@abgoswam abgoswam deleted the abgoswam/arguments branch February 20, 2019 16:58
@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.

3 participants