Reputation: 85
I'm training an SVM inside a for loop changing the features of my instances and I would like to plot the final objective value vs iteration. I'm using LIBSVM in Matlab but I don't find explicitly the final objective value in the returned model. How do I compute the final objective value with the returned model in each interation?
It's possible read the script printed by the svmtrain but I'd like to compute this value without this trick.
P.D. I have a basic knowledge of C++.
Upvotes: 0
Views: 1152
Reputation: 85
I modify the svm.cpp and svm.h to return the objective value adding a few lines of code.
1) Add new field in the svmmodel (svm.h) and decision_function (svm.cpp) structures.
2) Copy the si.obj in the new field of the decision_function.
3) Copy the field catch by the decision_function into the newer field of the svmmodel structure (svm_train function in the svm.cpp).
4) Modify the svm_model_matlab.c to admit the new field in the svmmodel structure.
It's really easy and straighforward.
I can pass the new files only send me an email with the purpose: LIBSVM-ObjModification
Upvotes: 1