-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Remove SVM from interfaces #5085
Comments
That is no problem, we can expose that lazily via Note we can also remove the |
The issue is that those functions require |
ah! crap! :) |
Would it be possible to just compute those values when |
they are computed anyways when fitting the model. |
The only use case I found of this in the library is in a notebook, where we get the objective values from training labels, not from new labels. But I guess if you want to compute it for new labels then this should be a metric class with an evaluate method (I know it might not make a lot of sense to call this a metric), or a free function |
Just realised, the solution is an observer |
Just to understand better, do you need to expose just computed values or directly a function which needs to be called by the user? :) |
@karlnapf I guess the idea is that these values are observed and you emit the observation when calling |
The observer would know that the user wants to access the objective values. It then simply stores them. During training, a needs to be omitted to the observer, which then checks whether it wants to store it, and if so, it calls it. Alternatively (as I think the objective is always computed during the training loop), can just emit it always... |
Currently we expose SVM to interfaces, but this is somewhat redundant as we expose
Machine
(andSVM
is aMachine
derived class). This was just a hack to make sure that only SVM types can be passed withput
to objects expecting anSVM
parameter. But now we can test at runtime if the object beingput
can be casted to the expected type:shogun/src/shogun/kernel/string/HistogramWordStringKernel.cpp
Lines 428 to 429 in f143eaf
So all
Machine
which expect anSVM
parameter (e.g.MKLClassification
) should have thiscastable
check and register the svm parameter as aMachine
. This will avoid having to cast machine to svm when passing it to things likeMKLClassifcation
:shogun/examples/undocumented/python/evaluation_cross_validation_mkl_weight_storage.py
Lines 41 to 42 in f143eaf
@karlnapf the only issue will be how does the user have access to
compute_svm_primal_objective
andcompute_svm_dual_objective
? Maybe SVM shouldn't be removed from swig, but classes likeMKL
should registerSVM
asMachine
? That way we avoid having to cast theMachine
object when it is just passed as an argument input
?The text was updated successfully, but these errors were encountered: