I am using LibSVM in Java, as follows:
LibSVM classifier = new LibSVM();
classifier.setCost(C);
I am interested in getting the weights w
and the parameter b
from the classifier, so as to characterize the separating hyperplane in case of linear kernel:
w^T x + b = 0
I have seen some other questions that suggest how to do this in MATLAB or other languages. However, it is not clear to me how to do this in Java. If you go for the documentation you find the method getWeights()
that, by reading the name, should return a list of weights. However, since:
- the return type is not the one that I was expecting (I would have expected something like
double[]
and not a singleString
) - the Javadoc is not clear (quoting: "Gets the parameters C of class i to weight[i]*C, for C-SVC (default 1).")
it is not clear whether these are the weights w
and b
I am looking for.
I have seen here another user having the same problem, but he did not find an answer to his question.
Thanks.