-
Notifications
You must be signed in to change notification settings - Fork 34
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
Core verbs #3
Comments
Let me start by saying that I have yet to take a close look into OnlineAI and OnlineStats (but I promise I will) This looks like a good start. Thanks for taking the time and kicking this off I think we should settle on either Concerning
I'm not convinced on that. Let's take (soft-margin) SVMs for example. The thing that really gives the SVM outcome a conceptual interpretation is the utilized loss function. so actually predicting a class is For me it boils down to this: I don't want the high level interface (i.e. for simply applying ML to some problem) to be the default. I want this framework to be research friendly. |
concerning |
Extending the conversation at OnlineStats... There are lots of different things that we're trying to cover with a single verb. What if we don't have a "batch" verb? At the core, there is only the constructor. The fit happens as part of model creation. Parameters, etc are passed into a constructor through some sort of parameter abstraction, and data is passed in through another abstraction, and the model is Another idea... what if the models are implicitly callable (by implementing
Then we never use a verb. 👍 |
I considered that approach before. I think it has some ugly problems. First of all I think scaling out using just language constructs should be simple. For that it would make sense if the model itself is more of a parameter container (this includes for example the loss functor). This small object would be easy to move around processes to train somewhere else. Bottom line it should be easy to decide when and where an object is trained vs when it's parameters are decided. Also I think we would throw away the beauty of Julia's multiple dispatch where a function can belong to different things equally. This way the training function is conceptionally no different than an OO method that is part of the model itself. How would a user be able to prototype a new kind of solver for example? While I think this works well for things like GLMs, I don't think it would be flexible enough for what I want KSVM.jl to be. Are you really that opposed to using |
Concerning the |
Also we should consider whether online updates should adopt the push/append idiom from base.
|
I don't think the descriptions for push/append quite match online updates:
I thought the idea was to use |
I certainly haven't settled on the "right" verbs yet. I'm leaning towards the method of aliases though. (const train = fit), etc. It might make it easier to link disparate packages.
|
I think this is frowned upon if I remember the Julia style guide correctly |
In the end I don't think there is a clear separation of online vs batch anyhow. I mean theoretically I could fit a logistic regression using BFGS with myfit = fit(MyModel(), solver=BFGS(), maxiter=10)
#....
fit!(myfit, solver=BFGS(), maxiter=100) The most readable thing to me would be to have one verb (plus the ! version of it) accross the bench that denotes "something is learning from data". The cool thing about Julia (and one of it's convincing aspects to me) is that if the code has a nice licence and is carefully crafted, it can also serve as reference implementation for the pseudocode of papers. So to me it would also be important that the package itself follows the same style that it's interface does (so I think it would be confusion if the user is used to If you are really that much against If you don't like that either maybe we can come up with a solution that uses two verbs where we can clearly define which verb is appropriate for which situation. I can see the case for |
On an other tangent: I have been thinking about your proposed "using the constructor to fit something" approach a bit. Although I still don't think it would be a good universal solution for all kinds of models, I have to admit that the approach is growing on me for things like PCA or CenterScale. I think you are on to something there |
The following seems like nice code to me (and having cs = CenterScale(Xtrain)
transform!(cs, Xtrain)
pca = PCA(Xtrain)
Xtrain2 = transform(pca, Xtrain)
myfit = fit(MyModel(), Xtrain2)
yhat = predict([cs, pca, myfit], Xtest) However, if we keep consistent with using So this code: cs = fit(CenterScale(), Xtrain)
Xtrain2 = predict(cs, Xtrain)
pca = fit(PCA(), Xtrain2)
Xtrain3 = predict(pca, Xtrain2)
myfit = fit(MyModel(), Xtrain3)
yhat = predict(myfit, Xtrain3) could be simplified to mypipe = fit([CenterScale(), PCA(), MyModel()], Xtrain)
# mypipe == [cs, pca, myfit]
yhat = predict(mypipe, Xtest) EDIT: So the objects like EDIT: I am not sure how it would work if we mix supervised and unsupervised models though |
Concerning verbs, we should keep an eye on PR87 of Optim.jl and use the same verbs where they make sense. Ultimately I'd like to move from Regression.jl to Optim.jl for deterministic optimization (because it is more general and has a more active community), but atm Regression.jl is faster (based on just two informal comparisons I did a month back. So this is not a very sound statement). |
Until there is something like OptimBase.jl I will introduce a dependency to Optim for the API verbs I mentioned. Not ideal, but Optim doesn't seem so heavyweight. thoughts? |
outsourced |
What are they, and what functionality and traits do they imply?
Here's a list to start discussion:
fit
:fit!
:transform
/predict
:evaluate
Others?
Notes:
const predict = transform
as a convenience is ok in my eyesThe text was updated successfully, but these errors were encountered: