-
Notifications
You must be signed in to change notification settings - Fork 1.9k
MLContext to create them all #1098
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
Comments
We don't like pass IHostEnvironment objects because they bloated, so let's create even more bloated object. Can we have something like this instead:
and just modify constructors in Estimators to accept MLContext? |
It's not quite so bad as all that. One of the details here you will see is that @Zruty0 has said, originally suggested by @eerhardt, is that this hypothetical object will explicitly implement the interface. Further, the numerous extensions to So despite being a single object kinda, it has a "dual nature" that reflects the dual usage of ML.NET, on the one hand a tool for exploiting ML by a user, as well as a tool into which one can plug ones own components. All without having to have parallel "user context" vs. "component context" object, which seems like an elegant solution. Of course, the idea of these property objects raises the specter that we're creating a "factory of everything" object which concerns me somewhat, but I think the pattern works here. |
"MLContext to create them all," |
We touched on this a little during our conversation. Is the logger a type of property as well in addition to BinaryClassification, Regression etc. In EF, The DbContext.Database.Log property can be set to a delegate for any method that takes a string e.g.:
This then allows the user to choose whether wants to write to console or Trace (in case of ASP.NET) or a file logger. This will also avoid any confusion on what LocalEnvironment, ConsoleEnvironment would mean for our users. In addition to this being consistent with EF and ASP.NET, which users already know and some consistency with API names which we have now with MLContext will make this a bit more .NETTY. Just my thoughts. |
It's a good point @asthana86 . We have |
During one of the in-person API reviews we agreed that it would be a good idea to have a single object
MLContext
that would serve as a 'factory of everything' (similar to the HTTP context / DB context in the .NET world).MLContext
will explicitly implementIHostEnvironment
, so you can create all the existing estimators by giving the context as the first argument.MLContext
will have propertiesBinaryClassification
,Regression
,Clustering
etc. for canonical ML tasks (the ones that are currently classes in themselves), complete withEvaluate
and all corresponding trainers.Transformation
,Filtering
,Loading
to instantiate all known transform estimators, filters and data readers (again via extension methods).SaveModel
andLoadModel
that handle model serialization./cc @KrzysztofCwalina @TomFinley @eerhardt @markusweimer @asthana86
The text was updated successfully, but these errors were encountered: