I have a classification task, and I use svm_perf application.

The question is having trained the model I wonder whether it's possible to get the weight of the features.

There is an -a parametes which outputs the alphas, honestly I don't recall alphas in SVM I think the weights are always w.

有帮助吗?

解决方案

If you are implementing linear SVM, there is a Python script based on the model file output by svm_learn and svm_perf_learn. To be more specific, the weight is just w=SUM_i (y_i*alpha_i*sv_i) where sv_i is the support vector, y_i is the category from trained sample.

If you are using non linear SVM, I don't think the weights coefficients are directly related to the input space. Yet you can get the decision function:

f(x) = sgn( SUM_i (alpha_i*y_i*K(sv_i,x)) + b );

where K is your kernel function.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top