【问题标题】:why training and testing file same in svmlight为什么 svmlight 中的训练和测试文件相同
【发布时间】:2014-02-09 05:09:17
【问题描述】:

我下载了适用于 linux 操作系统的 SVM-Light。运行命令。它产生 2 个可执行文件 svm_learn 和 svm_classify。使用这个我试图用以下代码执行一个示例文件(它包含一个train.dattest.dat 文件)

 ./svm_learn example1/train.dat example1/model.txt
 ./svm_classify example1/test.dat example1/model.txt example1/predictions.txt

之后我得到 2 个文本文件模型和预测。我是 svm 的新手。 为什么test.dattrain.dat 在示例文件中的格式相同?

test.dat   +1 6:0.0342598670723747 26:0.148286149621374 27:0.0570037235976456
train.dat   1 6:0.0198403253586671 15:0.0339873732306071 29:0.0360280968798065

输出类似

 > Scanning examples...done
    Reading examples into                                                                                                                                                                                    memory...100..200..300..400..500..600..700..800..900..1000..1100..1200..1300..1400..1500..1600..1700..1800..1900..2000..OK. (2000 examples read)
Setting default regularization parameter C=1.0000
Optimizing........................................................................................................................................................................................................................................................................................................................................................................................................................................done. (425 iterations)
Optimization finished (5 misclassified, maxdiff=0.00085).
Runtime in cpu-seconds: 0.07
Number of SV: 878 (including 117 at upper bound)
L1 loss: loss=35.67674
Norm of weight vector: |w|=19.55576
Norm of longest example vector: |x|=1.00000
Estimated VCdim of classifier: VCdim<=383.42790
Computing XiAlpha-estimates...done
Runtime for XiAlpha-estimates in cpu-seconds: 0.00
XiAlpha-estimate of the error: error<=5.85% (rho=1.00,depth=0)
XiAlpha-estimate of the recall: recall=>95.40% (rho=1.00,depth=0)
XiAlpha-estimate of the precision: precision=>93.07% (rho=1.00,depth=0)
Number of kernel evaluations: 45954
Writing model file...done

train.dat 是训练文件,所以在执行前被标记,那为什么test.dat 在执行前被标记呢?你能解释一下输出吗,尤其是precision,recall,error

【问题讨论】:

    标签: linux machine-learning data-mining svm svmlight


    【解决方案1】:

    测试数据也被标记,因此您的分类器可以被评估。如果测试集没有好的标签,就无法衡量它的质量。此信息在分类过程中不使用,仅用于检查良好分类的数量。错误、精度和召回度量是用于评估分类器的众多指标之一。

    • 错误 = number_of_times_your_model_was_wrong / all_test_cases
    • 精度 = TP / (TP + FP)
    • 召回 = TP / (TP + FN)

    在哪里

    • TP = 您的模型猜测 +1 的次数,它确实是 +1
    • FP = 您的模型猜测 +1 但实际上是 -1 的次数
    • FN = 您的模型猜测 -1 但实际上是 +1 的次数

    【讨论】:

      【解决方案2】:

      这种格式称为 LIBSVM 格式,因为它是由另一个 SVM 实现定义的,LIBSVM

      为什么您需要不同的文件格式来存储训练和评估数据?

      重复使用相同的格式两次要好得多,而不必支持另一种文件格式。

      另外,正如@lejlot 在他的回答中提到的,test 文件实际上需要相同的格式来进行 validation

      只有在将 SVM 应用于完全未知您没有标签的新数据时。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2016-10-06
        • 2014-04-15
        • 2013-08-05
        • 2018-02-25
        • 2017-01-10
        • 2016-04-07
        • 2013-03-04
        • 2014-06-08
        相关资源
        最近更新 更多