python libsvm:used函数:svm_predict(),输出“p_val”

时间:2015-06-05 08:29:12

标签: python libsvm

我使用python libsvm函数:

p_label, p_acc, p_val = svm_predict(y, x, model)

输出“p_val”出现问题。

任务问题是三个标签(+1,0,-1)分类。

我不知道它如何预测标签。我编写我的python代码:

y, x = svm_read_problem('test.data')
m = svm_train( y[0:900], x[0:900], opt )
p_label, p_acc, p_val = svm_predict( y[900:910], x[900:910], m )

有输出:

p_label(预测类)= [p_val(决策值或概率估计列表)]

  • -1.0 = [1.0449524711949485,1.4113796513344399,1.0120255052284173],

  • -1.0 = [1.0969353852717083,0.9601933938910249,0.3407227530552793],

  • -1.0 = [0.9608561833833849,1.4704797796797964,1.1354416470136237],

  • -1.0 = [0.5629743031525207,0.6418911014217697,0.5962484893807319],

  • -1.0 = [0.9998935746528146,0.9999862936350972,0.4352865894491481],

  • -1.0 = [0.5899682420542727,0.759898755977403,0.45466598793345214],

  • -1.0 = [0.8029330343073868,0.9565608406914972,0.7464642555671487],

  • -1.0 = [1.206590596563432,0.9205300145992189,-0.25622479105667184],

  • -1.0 = [0.75271162867797,0.9999549323095839,0.8478570959739556],

  • 0.0 = [-0.07135185943489092,0.483809082370377,0.764341953305053]]

我不知道“预测标签”和“决策值列表”之间的关系。

请给我一些建议!

2 个答案:

答案 0 :(得分:0)

p_val是为每个数据点获取一个实验室的概率

答案 1 :(得分:0)

也许您应该在函数svm_predict中输入“ -b 1”。那是predicting_options之一。那么p_val将是获得标签的概率。