如何在vowpal wabbit中为SVM返回[0,1]间隔中的预测

Aar*_*ron 1 vowpalwabbit

如果已经提出这个问题,请道歉.而不是原始预测(-r)我希望通过设置在[0,1]间隔中返回在vowpal wabbit中训练的SVM的预测-loss_function hinge.目前我正在尝试这个,但它没有给我我想要的东西.有什么想法吗?

vw -d vw_train_rand.vw -c -f svm_rand.vw --passes 10 --loss_function hinge -q cn;

vw -d vw_test_rand.vw -t -i svm_rand.vw -p preds_rand_svm.txt
Run Code Online (Sandbox Code Playgroud)

干杯

亚伦

编辑:

1)样本数据:

-1 |c Loan.TypeConventional:1 Loan.TypeFHA:0 Loan.TypeUnknown:0 Loan.TypeVA:0 |n Loan.Size:124500 LenderRank0612.0614:1939 ZipSquareMiles:53.1 MailDateMonth:5 ZipPerForeignBorn:11.4 ZipPerHighSchoolPlusDegree:57.2 ZipPerCollegePlusDegree:15.2 ZipPerVeterans:13.4 ZipPopPerSquareMile:798.1 ZipPerUnemployement:8.5 ZipSexRatio:96.7 ZipHousingUnitsPerSquareMile:315.1 ZipMedianHouseholdIncome:36238 ZipPerCapitaIncome:19085 MonthsDeedDatetoMailDate:2
-1 |c Loan.TypeConventional:1 Loan.TypeFHA:0 Loan.TypeUnknown:0 Loan.TypeVA:0 |n Loan.Size:232000 LenderRank0612.0614:391 ZipSquareMiles:99.1 MailDateMonth:5 ZipPerForeignBorn:11.8 ZipPerHighSchoolPlusDegree:73.3 ZipPerCollegePlusDegree:39.3 ZipPerVeterans:9.1 ZipPopPerSquareMile:485.5 ZipPerUnemployement:5.9 ZipSexRatio:98.5 ZipHousingUnitsPerSquareMile:169.6 ZipMedianHouseholdIncome:78465 ZipPerCapitaIncome:31908 MonthsDeedDatetoMailDate:3
-1 |c Loan.TypeConventional:1 Loan.TypeFHA:0 Loan.TypeUnknown:0 Loan.TypeVA:0 |n Loan.Size:90000 LenderRank0612.0614:130 ZipSquareMiles:32.6 MailDateMonth:5 ZipPerForeignBorn:51.5 ZipPerHighSchoolPlusDegree:60.7 ZipPerCollegePlusDegree:17.3 ZipPerVeterans:9.3 ZipPopPerSquareMile:783.2 ZipPerUnemployement:4.8 ZipSexRatio:97.2 ZipHousingUnitsPerSquareMile:274.2 ZipMedianHouseholdIncome:64668 ZipPerCapitaIncome:25632 MonthsDeedDatetoMailDate:3
-1 |c Loan.TypeConventional:0 Loan.TypeFHA:0 Loan.TypeUnknown:0 Loan.TypeVA:1 |n Loan.Size:121301 LenderRank0612.0614:23 ZipSquareMiles:6.8 MailDateMonth:5 ZipPerForeignBorn:14.9 ZipPerHighSchoolPlusDegree:63.9 ZipPerCollegePlusDegree:24.2 ZipPerVeterans:10 ZipPopPerSquareMile:5245.1 ZipPerUnemployement:7.1 ZipSexRatio:93.3 ZipHousingUnitsPerSquareMile:2001.6 ZipMedianHouseholdIncome:56398 ZipPerCapitaIncome:25815 MonthsDeedDatetoMailDate:2
Run Code Online (Sandbox Code Playgroud)

2)我目前得到的:

-1.001968
-1.000737
-1.000441
-1.001823
Run Code Online (Sandbox Code Playgroud)

3)我想看到的内容:连续[0,1]间隔中的预测,使得每个条目可以被解释为与事件相关联的预测概率,例如:

0.012
0.009
0.010
0.0085
Run Code Online (Sandbox Code Playgroud)

Mar*_*pel 5

如果你想预测概率,你应该训练--loss_function=logistic和测试--link=logistic.铰链损失(在SVM中使用)导致最大边缘分类器,其不适合于预测概率.

请注意,仅使用--loss_function=hinge不会从VW生成SVM(没有内核).如果您希望支持向量机具有在线方式训练的径向基础内核,请使用--kvsm --kernel=rbf(vw --ksvm -h | grep -A9 KSVM有关更多参数,请参阅参考资料).