Skip to content
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

Mark EntryPoints classes and APIs as internal #2674

Merged
merged 8 commits into from
Feb 22, 2019
Merged

Mark EntryPoints classes and APIs as internal #2674

merged 8 commits into from
Feb 22, 2019

Conversation

ganik
Copy link
Member

@ganik ganik commented Feb 21, 2019

fixes #2582 #1065

@@ -69,7 +69,8 @@ public sealed class Options : OnlineLinearOptions
/// Column to use for example weight.
/// </summary>
[Argument(ArgumentType.AtMostOnce, HelpText = "Column to use for example weight", ShortName = "weight", SortOrder = 4, Visibility = ArgumentAttribute.VisibilityType.EntryPointsOnly)]
public Optional<string> WeightColumn = Optional<string>.Implicit(DefaultColumnNames.Weight);
[BestFriend]
internal Optional<string> WeightColumn = Optional<string>.Implicit(DefaultColumnNames.Weight);
Copy link
Contributor

@Ivanidzo4ka Ivanidzo4ka Feb 21, 2019

Choose a reason for hiding this comment

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

internal Optional WeightColumn = Optional.Implicit(DefaultColumnNames.Weight); [](start = 12, length = 94)

How user suppose to specify weight column during training?
This algorithm supports weights column in dataview see line 149 #Resolved

Copy link
Contributor

@TomFinley TomFinley Feb 21, 2019

Choose a reason for hiding this comment

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

@Ivanidzo4ka is correct... this must continue to be supported.

To remind and possibly rephrase earlier conversations since they were somewhat informal, and I may not have expressed as clearly as might be desirable:

  1. You will rename this field WeightColumn something appropriate, like, say, WeightColumnOptional. To maintain the entry-point name, the Argument attribute will have its Name property set to WeightColumn. (Thereby making the entry-points remain unchanged.)

  2. You will introduce another field or property named WeightColumn intended for use from the API. This will be a public field, unadorned by an argument attribute, as it is not intended for Entry Point/Command Line use. This will be a string, not an Optional<string>.

  3. The code in LightGBM will appropriately adjust to the presence of either of these, thereby responding appropriately whether one or the other is set (or, as it may happen, not set). This may require some additional (hidden!) parameters somewhere to distinguish whether something was called from the command line/entry-points (in which case we'd expect the argument attribute field to be set), or the public surface of the API. There are many obvious ways of doing this, I'll trust we can figure out which is best.

The same pattern should be followed in other places where you are providing an "alternative" to the options. We want our Options object, where exposed, to expose all available options. (This in accordance of our usual attitude towards how these objects should behave, as captured in #1798.) #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.

As agreed made Weight and GroupId columns explicit strings


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

@@ -133,7 +133,8 @@ public sealed class OutputAttribute : Attribute
/// A node can be run without optional input fields.
/// </summary>
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)]
public sealed class OptionalInputAttribute : Attribute { }
[BestFriend]
internal sealed class OptionalInputAttribute : Attribute { }
Copy link
Contributor

@Ivanidzo4ka Ivanidzo4ka Feb 21, 2019

Choose a reason for hiding this comment

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

OptionalInputAttribute [](start = 30, length = 22)

why only this get changed?
And it's a part of internal static class, isn't it internal already? #Resolved

@@ -69,7 +69,8 @@ public sealed class Options : OnlineLinearOptions
/// Column to use for example weight.
/// </summary>
[Argument(ArgumentType.AtMostOnce, HelpText = "Column to use for example weight", ShortName = "weight", SortOrder = 4, Visibility = ArgumentAttribute.VisibilityType.EntryPointsOnly)]
public Optional<string> WeightColumn = Optional<string>.Implicit(DefaultColumnNames.Weight);
[BestFriend]
Copy link
Contributor

@TomFinley TomFinley Feb 21, 2019

Choose a reason for hiding this comment

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

[BestFriend] [](start = 12, length = 12)

I see no particular reason for this to be best-friended with anything. Your public surface will not involve this attribute. This field will only be used via entry-points and suchlike. #Resolved

Copy link
Contributor

@TomFinley TomFinley left a comment

Choose a reason for hiding this comment

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

The functionality currently exposed as optional arguments must continue to be supported through alternate means, they must not just be hidden altogether.

@@ -26,6 +26,7 @@
[assembly: InternalsVisibleTo(assemblyName: "Microsoft.ML.HalLearners" + PublicKey.Value)]
[assembly: InternalsVisibleTo(assemblyName: "Microsoft.ML.KMeansClustering" + PublicKey.Value)]
[assembly: InternalsVisibleTo(assemblyName: "Microsoft.ML.LightGBM" + PublicKey.Value)]
[assembly: InternalsVisibleTo(assemblyName: "Microsoft.ML.LightGBM.StaticPipe" + PublicKey.Value)]
Copy link
Member

@eerhardt eerhardt Feb 21, 2019

Choose a reason for hiding this comment

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

Will we still need this after @TomFinley's comments are addressed? (Basically to keep a public string WeightColumn property) #Resolved

@codecov
Copy link

codecov bot commented Feb 22, 2019

Codecov Report

Merging #2674 into master will increase coverage by <.01%.
The diff coverage is 74.28%.

@@            Coverage Diff             @@
##           master    #2674      +/-   ##
==========================================
+ Coverage   71.57%   71.57%   +<.01%     
==========================================
  Files         800      805       +5     
  Lines      141789   141993     +204     
  Branches    16107    16119      +12     
==========================================
+ Hits       101488   101637     +149     
- Misses      35851    35918      +67     
+ Partials     4450     4438      -12
Flag Coverage Δ
#Debug 71.57% <74.28%> (ø) ⬆️
#production 67.87% <68.96%> (-0.01%) ⬇️
#test 85.73% <100%> (-0.02%) ⬇️
Impacted Files Coverage Δ
...rc/Microsoft.ML.Core/EntryPoints/PredictorModel.cs 100% <ø> (ø) ⬆️
src/Microsoft.ML.Core/EntryPoints/ModuleArgs.cs 57.32% <ø> (-0.98%) ⬇️
...rc/Microsoft.ML.Data/EntryPoints/EntryPointNode.cs 68.58% <ø> (-0.27%) ⬇️
src/Microsoft.ML.Data/Training/TrainerUtils.cs 70.48% <ø> (-0.3%) ⬇️
...rc/Microsoft.ML.Core/EntryPoints/TransformModel.cs 100% <ø> (ø) ⬆️
src/Microsoft.ML.Data/EntryPoints/InputBuilder.cs 81.65% <ø> (ø) ⬆️
...ML.LightGBM.StaticPipe/LightGbmStaticExtensions.cs 46.42% <0%> (ø) ⬆️
...actorizationMachine/FactorizationMachineTrainer.cs 88.18% <0%> (ø) ⬆️
src/Microsoft.ML.StaticPipe/LbfgsStatic.cs 53.15% <100%> (ø) ⬆️
src/Microsoft.ML.LightGBM/LightGbmTrainerBase.cs 62% <100%> (+0.18%) ⬆️
... and 42 more
#Resolved

@Ivanidzo4ka
Copy link
Contributor

Ivanidzo4ka commented Feb 22, 2019

image
#Resolved

@@ -147,7 +147,7 @@ internal FieldAwareFactorizationMachineTrainer(IHostEnvironment env, Options opt
FeatureColumns[i + 1] = new SchemaShape.Column(options.ExtraFeatureColumns[i], SchemaShape.Column.VectorKind.Vector, NumberDataViewType.Single, false);

LabelColumn = new SchemaShape.Column(options.LabelColumn, SchemaShape.Column.VectorKind.Scalar, BooleanDataViewType.Instance, false);
WeightColumn = options.WeightColumn.IsExplicit ? new SchemaShape.Column(options.WeightColumn, SchemaShape.Column.VectorKind.Scalar, NumberDataViewType.Single, false) : default;
WeightColumn = options.WeightColumn != null ? new SchemaShape.Column(options.WeightColumn, SchemaShape.Column.VectorKind.Scalar, NumberDataViewType.Single, false) : default;
Copy link
Contributor

Choose a reason for hiding this comment

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

ptions.WeightColumn != null ? new SchemaShape.Column(options.WeightColumn, SchemaShape.Column.VectorKind.Scalar, NumberDataViewType.Single, false) : default [](start = 28, length = 156)

TrainerUtils.MakeR4ScalarWeightColumn?

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:

Copy link
Contributor

@TomFinley TomFinley left a comment

Choose a reason for hiding this comment

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

Thank you @ganik !!

@Ivanidzo4ka Ivanidzo4ka merged commit b604b07 into dotnet:master Feb 22, 2019
@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.

Mark EntryPoints classes and APIs as internal
4 participants