gpt4 book ai didi

linux - 为什么 svmlight 中的训练和测试文件相同

转载 作者:太空宇宙 更新时间:2023-11-04 04:05:45 32 4
gpt4 key购买 nike

我下载了适用于 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在执行前就打了标签呢?你能解释一下输出,特别是术语精度、召回率、错误

最佳答案

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

  • 错误 = 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 的次数

关于linux - 为什么 svmlight 中的训练和测试文件相同,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21227088/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com