- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用vowpal wabbit进行逻辑回归。我不确定这是否是正确的语法
For training, I do
./vw -d ~/Desktop/new_data.txt --passes 20 --binary --cache_file cache.txt -f lr.vw --loss_function logistic --l1 0.05
For testing I do
./vw -d ~/libsvm-3.18_test/matlab/new_data_test.txt --binary -t -i lr.vw -p predictions.txt -r raw_score.txt
-1:1.00038 | 110:0.30103 262:0.90309 689:1.20412 1103:0.477121 1286:1.5563 2663:0.30103 2667:0.30103 2715:4.63112 3012:0.30103 3113:8.38411 3119:4.62325 3382:1.07918 3666:1.20412 3728:5.14959 4029:0.30103 4596:0.30103
1:2601.25 | 32:2.03342 135:3.77379 146:3.19535 284:2.5563 408:0.30103 542:3.80618 669:1.07918 689:2.25527 880:0.30103 915:1.98227 1169:5.35371 1270:0.90309 1425:0.30103 1621:0.30103 1682:0.30103 1736:3.98227 1770:0.60206 1861:4.34341 1900:3.43136 1905:7.54141 1991:5.33791 2437:0.954243 2532:2.68664 3370:2.90309 3497:0.30103 3546:0.30103 3733:0.30103 3963:0.90309 4152:3.23754 4205:1.68124 4228:0.90309 4257:1.07918 4456:0.954243 4483:0.30103 4766:0.30103
-1 | 110:0.90309 146:1.64345 543:0.30103 689:0.30103 1103:0.477121 1203:0.30103 1286:2.82737 1892:0.30103 2271:0.30103 2715:4.30449 3012:0.30103 3113:7.99039 3119:4.08814 3382:1.68124 3666:0.60206 3728:5.154 3960:0.778151 4309:0.30103 4596:0.30103 4648:0.477121
最佳答案
总结arielf的详细答案。
A. Prepare the training data
grep '^-1' train.txt | shuf > neg.txt
grep '^1' train.txt | shuf > p.txt
for i in `seq 2000`; do cat p.txt; done > pos.txt
paste -d '\n' neg.txt pos.txt > newtrain.txt
B. Train model.vw
# Note that passes=1 is the default.
# With one pass, holdout_off is the default.
`vw -d newtrain.txt --loss_function=logistic -f model.vw`
#average loss = 0.0953586
C. Compute test loss using vw
`vw -d test.txt -t -i model.vw --loss_function=logistic -r
raw_predictions.txt`
#average loss = 0.0649306
D. Compute AUROC using http://osmot.cs.cornell.edu/kddcup/software.html
cut -d ' ' -f 1 test.txt | sed -e 's/^-1/0/' > gold.txt
$VW_HOME/utl/logistic -0 raw_predictions.txt > probabilities.txt
perf -ROC -files gold.txt probabilities.txt
#ROC 0.83484
perf -ROC -plot roc -files gold.txt probabilities.txt | head -n -2 > graph
echo 'plot "graph"' | gnuplot -persist
关于classification - 如何在非常不平衡的数据集上使用vowpal wabbit执行logistic回归,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24634602/
给定经过训练的上下文老虎机模型,如何检索测试样本的预测向量? 例如,假设我有一个名为“train.dat”的火车集,其中包含格式如下的行 1:-1:0.3 | a b c # 2:2:0.3 |
我有以下所有分类变量的数据: class education income social_standing 1 basic low g
我已经开始使用 Vowpal Wabbit 对于逻辑回归,但是我无法重现它给出的结果。也许它确实有一些未记录的“魔法”,但是有没有人能够复制/验证/检查逻辑回归的计算? 例如,使用下面的简单数据,我们
最近我在使用 Vowpal Wabbit 进行分类,我得到了一个关于 readable_model 的问题。 这是我的命令:vw --quiet --save_resume --compressed
我想使用空模型对 vowpal wabbit 进行线性回归(仅截取 - 用于比较原因)。我应该为此使用哪个优化器?还是简单平均的最佳常量损失报告? 最佳答案 A1:对于线性回归,如果您关心平均值,您应
我一直在努力理解 vowpal wabbit 算法。有没有人可以帮助我了解 VW 以及如何实现它 最佳答案 Vowpal Wabbit专注于在线学习(虽然它也可以批处理 L-BFGS),它的主要算法是
我正在查看以下 2 个关于 VW 在使用 --adaptive 标志时所做的更新的演示。 似乎它们是不同的。 http://www.slideshare.net/jakehofman/technica
我编写了一个java代码来按以下方式执行Vowpal Wabbit: System.out.println("Executing command " + command); fina
我正在尝试对 Vowpal 中的样本数据运行逻辑回归。我创建了一个示例数据集,如下所示: 1 1.0 | a:3.28 b:1.5 c:2.0 |example -1 1.0 | a:1.25
我知道大众汽车可以处理非常原始的数据(例如原始文本),但例如,在将数据输入大众汽车之前是否应该考虑缩放数字特征?考虑以下行: 1 |n 年龄:80.0 高度:180.0 |c 伦敦男 |d the:1
我很好奇大众似乎通过 -q 参数创建交互项的方式。 为了这个插图的目的,我使用了这个玩具数据,它被称为cats.vm: 1 |a black |b small green |c numvar1:1.
我有几个关于大众汽车简单运行的输出的问题。我已经阅读了互联网和维基网站,但仍然不确定一些基本的事情。 我对波士顿住房数据进行了以下操作: vw -d housing.vm --progress 1 其
在这种情况下,输入之一是选择 ARM / Action 的概率,但我们如何找到该概率? 找到这个概率本身不是一项艰巨的任务吗? 最佳答案 提供概率意味着您正在假设您正在提供历史上采取的行动,例如从日志
我正在尝试使用隐藏的散列来保存vowpal wabbit模型。我有一个有效的模型,它包含以下内容: vw --oaa 2 -b 24 -d mydata.vw --readable_model mym
我的目标是在参数空间中对各种 VW 模型进行网格搜索(尝试不同的损失函数和正则化等)。由于模型可以使用多次传递,我想使用交叉验证。我想知道我是否应该实现我自己的交叉验证代码(也许作为一个 bash 脚
关闭。这个问题需要更多focused .它目前不接受答案。 想改善这个问题吗?更新问题,使其仅关注一个问题 editing this post . 3年前关闭。 Improve this questi
我有一个数据集(有 6 个目标类)的多类分类问题。训练数据的类标签分布偏斜:下面是每个类标签(1 到 6)的分布 (array([174171, 12, 29, 8285, 9
抱歉,我确实觉得我忽略了一些非常明显的事情。 但是怎么会发生以下情况: $ cat myTrainFile.txt 1:1 |f 1:12 2:13 2:1 |f 3:23 4:234 3:1 |f
我对 Vowpal wabbit 比较陌生,想了解 -b 参数(特征表中的特征位)。 我的训练数据是这样的。总共约100万字。 1 | a = "word" b ="word131232" c="wo
对不起,我确实觉得我忽略了一些非常明显的事情。 但是怎么会发生下面的事情: $ cat myTrainFile.txt 1:1 |f 1:12 2:13 2:1 |f 3:23 4:234 3:1 |
我是一名优秀的程序员,十分优秀!