问题描述
我正在使用 libsvm 创建2类分类器.我希望提取./svm-train training.training model.model
I am using libsvm for creating a 2-classes classifier.I wish to extract the coefficient/weight of each feature used by the model generated by ./svm-train training.training model.model
model.model
文件如下所示:
svm_type c_svc
kernel_type rbf
gamma 8
nr_class 2
total_sv 442
rho 21
label 1 -1
nr_sv 188 254
SV
7080.357768871263 0:0 1:0.00643 2:0.01046 3:0.00963 4:0.02777 5:0.04338 19:0.04468
528.7111702760092 0:0 1:0.00058 3:0.00086 6:0.01158 7:0.0028 9:0.08991 13:0.0096
...
391.7649705739246 0:0 1:0.00055 3:0.00082 5:0.04615 7:0.06374 21:0.00374 31:0.00339 33:0.00395 38:0.16343
...
-564.1329424321915 0:0 1:0.00709 2:0.00384 3:0.00709 5:0.00399 9:0.01457 10:0.01244 11:0.0206 17:0.02124 20:0.00565 23:0.00846 27:0.04692 33:0.04271 35:0.02389 36:0.00859 39:0.02014
我怎么知道svm-predict [options] test.test model.model out.out
将使用哪些系数/权重?最后一行的那些?
How do I know which coefficients/weights will be used by svm-predict [options] test.test model.model out.out
? The ones from the last line ?
谢谢,M.
推荐答案
根据官方常见问题解答条目,其中包含以下信息:
The model file generated by LIBSVM
consists, according to the offical FAQ entry, of the following information:
+-+-+-+--------------------+
|1|1|1| |
|v|v|v| SVs from class 1 |
|2|3|4| |
+-+-+-+--------------------+
|1|2|2| |
|v|v|v| SVs from class 2 |
|2|3|4| |
+-+-+-+--------------------+
|1|2|3| |
|v|v|v| SVs from class 3 |
|3|3|4| |
+-+-+-+--------------------+
|1|2|3| |
|v|v|v| SVs from class 4 |
|4|4|4| |
+-+-+-+--------------------+
还有一个示例如何读取此数据以便为二进制分类器计算w
.
There is also an example of how to read this data in order to compute w
for a binary classifier.
这篇关于从libsvm模型文件中提取系数/权重的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!