【发布时间】:2014-04-26 18:25:47
【问题描述】:
我在守护程序模式下运行 VW。作为一个独立的可执行文件,它运行得非常好。在守护程序模式下,我最初会看到一些关于预测和选项的信息,但看不到最终结果。不确定到底发生了什么。
这就是我所说的 VW6
/bin64/vw --daemon --num_children 2 -t -i ~/modelbow.vw6 --min_prediction 0 --max_prediction 1 -p stdout 2>&1
我检查 vw6 运行良好。我使用简单的 php 脚本发送数据(为简洁起见,删除了调试行):
$fp = fsockopen("localhost",26542, $errno, $errstr, 3);
$fp_dat = fopen("/tmp/ml.dat", "r");
$mldata = explode("\n", file_get_contents("/tmp/ml.dat"));
$mlstr = implode($mldata);
fwrite($fp, $mlstr);
$result = trim(fgets($fp, 1024));
print $result;
上面的打印 $result 什么也不打印。我在标准输出中看到的唯一内容是
num sources = 1
Num weight bits = 28
learning rate = 10
initial_t = 1
power_t = 0.5
decay_learning_rate = 1
predictions = stdout
only testing
average since example example current current current
loss last counter weight label predict features
在独立可执行模式下,如果我使用相同型号的相同 dat 文件运行但没有 -daemon 选项,它会在最后很高兴地给出结果
...
...
predictions = stdout
only testing
average since example example current current current
loss last counter weight label predict features
1.000000 ba66dfc7a135e2728d08010b40586b90
知道守护程序模式会出现什么问题吗?我也尝试使用 -p /tmp/ 选项...使用 sudo 运行守护程序模式,但没有任何帮助。是否有调试转储选项或详细选项或其他东西来知道到底发生了什么?
谢谢
【问题讨论】:
-
刚刚在 vw wiki 上添加了一个经过测试/工作的示例:github.com/JohnLangford/vowpal_wabbit/wiki/daemon-example 您的代码不起作用的原因可能是 PHP 中的缓冲问题。这个例子(抱歉,不是 PHP)演示了从同一个套接字写入和读取“正常工作”。 HTH。
标签: php machine-learning vowpalwabbit