我正在尝试使用大众汽车来查找可预测某人是否会打开电子邮件的单词或短语。如果他们打开电子邮件,则目标为1,否则为0。我的数据如下所示:
1 |A this is a test
0 |A this test is only temporary
1 |A i bought a new polo shirt
1 |A that was a great online sale
我将其放入名为“ test1.txt”的文件中,然后运行以下代码来执行ngrams of 2并输出变量信息:
C:\~\vw>perl vw-varinfo.pl -V --ngram 2 test1.txt >> out.txt
当我查看输出时,有一些原始数据中没有的双语法例。这是一个错误还是我误解了。
输出:
FeatureName HashVal MinVal MaxVal Weight RelScore
A^a 239656 0.00 1.00 +0.1664 100.00%
A^is 7514 0.00 1.00 +0.0772 46.38%
A^test 12331 0.00 1.00 +0.0772 46.38%
A^this 169573 0.00 1.00 +0.0772 46.38%
A^bought 245782 0.00 1.00 +0.0650 39.06%
A^i 245469 0.00 1.00 +0.0650 39.06%
A^new 51974 0.00 1.00 +0.0650 39.06%
A^polo 48680 0.00 1.00 +0.0650 39.06%
A^shirt 73882 0.00 1.00 +0.0650 39.06%
A^great 220692 0.00 1.00 +0.0610 36.64%
A^online 147727 0.00 1.00 +0.0610 36.64%
A^sale 242707 0.00 1.00 +0.0610 36.64%
A^that 206586 0.00 1.00 +0.0610 36.64%
A^was 223274 0.00 1.00 +0.0610 36.64%
A^a^bought 216990 0.00 0.00 +0.0000 0.00%
A^bought^great 7122 0.00 0.00 +0.0000 0.00%
A^great^i 190625 0.00 0.00 +0.0000 0.00%
A^i^is 76227 0.00 0.00 +0.0000 0.00%
A^is^new 140536 0.00 0.00 +0.0000 0.00%
A^new^online 69117 0.00 0.00 +0.0000 0.00%
A^online^only 173498 0.00 0.00 +0.0000 0.00%
A^only^polo 51059 0.00 0.00 +0.0000 0.00%
A^polo^sale 131483 0.00 0.00 +0.0000 0.00%
A^sale^shirt 191329 0.00 0.00 +0.0000 0.00%
A^shirt^temporary 81555 0.00 0.00 +0.0000 0.00%
A^temporary^test 90632 0.00 0.00 +0.0000 0.00%
A^test^that 13689 0.00 0.00 +0.0000 0.00%
A^that^this 127863 0.00 0.00 +0.0000 0.00%
A^this^was 22011 0.00 0.00 +0.0000 0.00%
Constant 116060 0.00 0.00 +0.1465 0.00%
A^only 62951 0.00 1.00 -0.0490 -29.47%
A^temporary 44641 0.00 1.00 -0.0490 -29.47%
例如,^bought^great
实际上从未在任何原始输入行中发生。难道我做错了什么?
这是vw-varinfo中的错误。
可以通过vw
单独运行来验证--invert_hash
:
$ vw --ngram 2 test1.txt --invert_hash train.ih
$ grep '^bought^great' train.ih
# no output
快速的部分解决方法是将权重为0.0的所有特征视为高度可疑,甚至可能是虚假的。不幸的是,有一些失踪过,因为一些功能vw-varinfo
一无所知--ngram
。
我真的需要重写vw-varinfo
。vw
自从vw-varinfo
编写以来,已经发生了很大的变化,再加vw-varinfo
上编写时未达到最佳状态,重复了许多vw
本身已经存在的跨功能逻辑。我想到的新实现应该显着提高效率,并且不易受到此类错误的影响。
由于紧急情况,该项目被暂停。希望今年能有时间纠正。
不相关的提示:由于您正在执行二进制分类,因此应在{-1,1}中使用标签,而不是在{0,1}中使用标签,--loss_function logistic
以取得最佳效果。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句