libsvm格式学习

libsvm内部规定了标准格式:

1   1:203   2:197   3:190   4:188   5:2237
2   1:204   2:196   3:190   4:186   5:2228
3   1:203   2:196   3:190   4:186   5:2242
4   1:204   2:197   3:191   4:188   5:2265

  我现在保存的数据时:

15 292.076 368.506
0 9878.14 6384.54
1 2552.04 1975.08
2 7068.21 3751.98
3 38925.4 28155.5
5 6546.16 6190.8
8 20565.1 19577.6
153 719.419 445.856
221 1263.61 1319.79
257 13667.9 11287
324 289.799 198.903
326 3176.5 1043.68
406 8271.4 5257.4

  还有

15  5.0497 0.00673186 0.153175 587.357  4.83739 0.0083912 0.108304 1303.71  4.96099 0.00723208 0.0982569 857.179  4.85429 0.00810185 0.137245 730.417 
0  8.39929 0.000303776 0.144082 1194.55  8.47568 0.000265841 0.122669 1759.04  8.41226 0.000306339 0.14458 943.461  8.42323 0.000293374 0.135613 1132.5 
1  7.24972 0.00074159 0.0940804 1843.64  7.26281 0.000721253 0.0842109 2544.54  7.26989 0.000725372 0.0939313 1318.19  7.2393 0.000747291 0.0831198 1594.29 
2  7.06406 0.00145372 0.230782 328.646  7.19887 0.00113057 0.195705 418.147  7.1122 0.00129046 0.214636 319.442  7.16374 0.00118874 0.192897 396.367 
3  7.51161 0.00138789 0.289538 423.817  7.68022 0.00103136 0.242301 644.431  7.54177 0.00131854 0.280213 470.175  7.64701 0.00107285 0.249446 464.878 
5  6.53459 0.00201017 0.281113 71.4772  6.64599 0.00172152 0.249118 96.3955  6.54528 0.00197663 0.280032 58.3045  6.69313 0.00161695 0.249121 96.8596 

  因此需要进行转化,问题是在保存特征时就保存成指定格式,还是保存了自己的格式再转化成svm的格式呢?这是个问题呀!

现在实现了保存完特征,然后按照网上说的用那个svm.xls的宏转换成svm支持的excel格式,然后再复制进txt内,格式如下:

15	 1:292.076	 2:368.506	 3:5.0497	 4:.00673186	 5:.153175	 6:587.357	 7:4.83739	 8:.0083912	 9:.108304	 10:1303.71	 11:4.96099	 12:.00723208	 13:.0982569	 14:857.179	 15:4.85429	 16:.00810185	 17:.137245	 18:730.417
0	 1:9878.14	 2:6384.54	 3:8.39929	 4:.000303776	 5:.144082	 6:1194.55	 7:8.47568	 8:.000265841	 9:.122669	 10:1759.04	 11:8.41226	 12:.000306339	 13:.14458	 14:943.461	 15:8.42323	 16:.000293374	 17:.135613	 18:1132.5
1	 1:2552.04	 2:1975.08	 3:7.24972	 4:.00074159	 5:.0940804	 6:1843.64	 7:7.26281	 8:.000721253	 9:.0842109	 10:2544.54	 11:7.26989	 12:.000725372	 13:.0939313	 14:1318.19	 15:7.2393	 16:.000747291	 17:.0831198	 18:1594.29
2	 1:7068.21	 2:3751.98	 3:7.06406	 4:.00145372	 5:.230782	 6:328.646	 7:7.19887	 8:.00113057	 9:.195705	 10:418.147	 11:7.1122	 12:.00129046	 13:.214636	 14:319.442	 15:7.16374	 16:.00118874	 17:.192897	 18:396.367
3	 1:38925.4	 2:28155.5	 3:7.51161	 4:.00138789	 5:.289538	 6:423.817	 7:7.68022	 8:.00103136	 9:.242301	 10:644.431	 11:7.54177	 12:.00131854	 13:.280213	 14:470.175	 15:7.64701	 16:.00107285	 17:.249446	 18:464.878
5	 1:6546.16	 2:6190.8	 3:6.53459	 4:.00201017	 5:.281113	 6:71.4772	 7:6.64599	 8:.00172152	 9:.249118	 10:96.3955	 11:6.54528	 12:.00197663	 13:.280032	 14:58.3045	 15:6.69313	 16:.00161695	 17:.249121	 18:96.8596
8	 1:20565.1	 2:19577.6	 3:6.18437	 4:.00536722	 5:.413925	 6:94.8801	 7:6.37937	 8:.00384318	 9:.341338	 10:116.641	 11:6.21197	 12:.00500522	 13:.40278	 14:81.2353	 15:6.36368	 16:.0039838	 17:.350601	 18:130.951
153	 1:719.419	 2:445.856	 3:6.42248	 4:.00165039	 5:.0992912	 6:1350.89	 7:6.36001	 8:.00176376	 9:.0870104	 10:2017.64	 11:6.415	 12:.00167259	 13:.100568	 14:1353.23	 15:6.38053	 16:.00171507	 17:.0816142	 18:1794.12

  

你可能感兴趣的:(lib)