1 原始数据
samples.txt
+2 1:47817578 2:117348 3:41170351 4:201515
+2 1:39301334 2:156188 3:33958277 4:194650
+1 1:69723870 2:88085 3:62840950 4:209127
+1 1:71368734 2:88150 3:64478712 4:209395
+3 1:23745724 2:188299 3:18677611 4:185112
+2 1:40632238 2:119584 3:33491192 4:199092
+2 1:50372906 2:120723 3:43938211 4:201544
+2 1:38787418 2:128953 3:31769247 4:197855
+2 1:50824026 2:127297 3:43188486 4:200509
2 归一化数据(dos命令:svm-scale –l 0 –u 1 samples.txt > samples-scale.txt)
samples-scale.txt:
2 1:0.505467 2:0.292005 3:0.491096 4:0.675493
2 1:0.326641 2:0.679576 3:0.333631 4:0.392785
1 1:0.965461 3:0.964242 4:0.988963
1 1:1 2:0.000648612 3:1 4:1
3 2:1
2 1:0.354587 2:0.314317 3:0.323433 4:0.575711
2 1:0.559124 2:0.325683 3:0.551528 4:0.676687
2 1:0.315849 2:0.407807 3:0.285837 4:0.52477
2 1:0.568597 2:0.391283 3:0.535159 4:0.634065
3 训练样本(dos命令: svm-train samples-scale.txt train-result.txt)
train-result.txt:
svm_type c_svc
kernel_type rbf
gamma 0.25
nr_class 3
total_sv 7
rho -0.701704 -0.864188 -0.375774
label 2 1 3
nr_sv 4 2 1
SV
0.453445662711471 0 1:0.505467 2:0.292005 3:0.491096 4:0.675493
0 1 1:0.326641 2:0.679576 3:0.333631 4:0.392785
1 0 1:0.559124 2:0.325683 3:0.551528 4:0.676687
0.5465543372885291 0 1:0.568597 2:0.391283 3:0.535159 4:0.634065
-1 1 1:0.965461 3:0.964242 4:0.988963
-1 0 1:1 2:0.000648612 3:1 4:1
-1 -1 2:1
4 预测
预测数据:temp.txt:
+2 1:47017578 2:107348 3:40170351 4:161515
预测dos命令:svm-predict temp.txt train-result.txt predict-result.txt
预测结果predict-reuslt.txt:
2
5结论:预测结果正确