-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Mark EntryPoints classes and APIs as internal #2674
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
Conversation
@@ -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); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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:
-
You will rename this field
WeightColumn
something appropriate, like, say,WeightColumnOptional
. To maintain the entry-point name, theArgument
attribute will have itsName
property set toWeightColumn
. (Thereby making the entry-points remain unchanged.) -
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 astring
, not anOptional<string>
. -
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
There was a problem hiding this comment.
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 { } |
There was a problem hiding this comment.
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] |
There was a problem hiding this comment.
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
There was a problem hiding this 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)] |
There was a problem hiding this comment.
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 Report
@@ 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
|
@@ -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; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @ganik !!
fixes #2582 #1065