-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Creation of components through MLContext: advanced options and other feedback #1798
Comments
One point that @glebuk brought up I wanted to make explicit, since I did not consider it before, is that by doing this, if we decide down the line to add more options to the "regular" options, we are free to do so. If we had the existing arrangement, then in order to maintain the API, if we made more regular default parameters. E.g., if we have this: Create(int a, int b, int c, Action<Arguments> advancedSettings = null) We could not have this, since this could break the signature. Create(int a, int b, int c, int d, Action<Arguments> advancedSettings = null) And the only way we see of not breaking the signature would be appending it to the end, which is very awkward and strange looking. Create(int a, int b, int c, Action<Arguments> advancedSettings = null, int d = 1) But if we had this: Create(int a, int b, int c)
Create(Arguments advancedSettings) Then we're free to do this: Create(int a, int b, int c, int d = 1)
Create(Arguments advancedSettings) |
This PR addresses the estimators inside HalLearners: Two public extension methods, one for simple arguments and the other for advanced options Delete unecessary constructors Pass Options objects as arguments instead of Action delegate Rename Arguments to Options Rename Options objects as options (instead of args or advancedSettings used so far)
This PR addresses the estimators inside HalLearners: Two public extension methods, one for simple arguments and the other for advanced options Delete unecessary constructors Pass Options objects as arguments instead of Action delegate Rename Arguments to Options Rename Options objects as options (instead of args or advancedSettings used so far)
This PR addresses the estimators inside HalLearners: Two public extension methods, one for simple arguments and the other for advanced options Delete unecessary constructors Pass Options objects as arguments instead of Action delegate Rename Arguments to Options Rename Options objects as options (instead of args or advancedSettings used so far)
* Towards #1798 . This PR addresses the estimators inside HalLearners: Two public extension methods, one for simple arguments and the other for advanced options Delete unecessary constructors Pass Options objects as arguments instead of Action delegate Rename Arguments to Options Rename Options objects as options (instead of args or advancedSettings used so far)
marking as Done, and closing this isssue. All learners have been taken care of. |
* samples and documentation * addressing issue #1798 for the Image Analytics project.
Forgive me my intrusion into this wonderful conversation, but I have question from user, which I'm don't know how to answer. number 1 in Senja list states
How we come up to this decision, and what is root cause behind hiding constructors for trivial transforms? /cc @JakeRadMSFT |
In our estimators and other similar components often have advanced settings, because, sometimes people have unusual circumstances. At the same time, there is a 95% or 99% scenario for "simple" usage that most people will be happy with. For this reason we have often made a distinction between common and advanced settings, as we see here.
machinelearning/src/Microsoft.ML.FastTree/TreeTrainersCatalog.cs
Lines 29 to 38 in cb37c7e
There are some possible things that excited feedback:
Echoing feedback seen in Rename mlContext.Data.TextReader() to mlContext.Data.CreateTextLoader() #1690, these things where we're making something should have the prefix
Create
, even in situations where this a catalog where we are always creating. Note:Create
preferred toMake
.The worth of ASP.NET style configuration was questioned (seen above as
Action<FastTreeRegressionTrainer.Arguments> advancedSettings
), e.g., there may not be much purpose in having a delegate. The older style where it just takes theArguments
period was preferred.Having this
Arguments
object as a nested class the component being created was viewed as positive, but this would be more idiomatically calledOptions
--Arguments
was a holdover name from when these were exclusively for command line arguments, but for the API this is not a great name. So while keeping the general structure of how they are placed currently, they should probably be renamed toOptions
.It is good to have the convenience for the simple arguments, however, if we have both simple and advanced settings, we should not mix them but have instead two distinct constructors/extension methods. (E.g., in the above, we would have two methods, one that took the advanced options.) To do otherwise is to invite confusion about which "wins" if we have the setting set in both.
If the simple arguments are totally sufficient, then there is no need to expose this
Arguments
class in hte public API. (For practical reasons relating to command line and entry-point usage, we still need to always have theseArguments
objects, but if they serve no purpose for the API the class can simply be made internal.)/cc @KrzysztofCwalina, @terrajobst , on whose feedback this list is primarily based, and who can correct me and provide clarification in case I misspoke.
The text was updated successfully, but these errors were encountered: