我编写了一个 java 代码以通过以下方式执行 Vowpal Wabbit:
System.out.println("Executing command " + command);
final Runtime r = Runtime.getRuntime();
final Process p = r.exec(command);
System.out.println("waiting for the process");
try (final BufferedReader b = new BufferedReader(new InputStreamReader(p.getInputStream()))) {
String line;
while ((line = b.readLine()) != null) {
final T lineResult = textParser.parseLine(line);
parserResultCombiner.addToCombiner(lineResult);
}
}
p.waitFor();
System.out.println("done");
}
命令在哪里
vw -d input.txt --loss_function=logistic -f model.vw
这样做的缺点是它需要写入磁盘。经过一番搜索,我了解到 vowpal wabbit 支持从 R 中的标准输入示例中读取数据
我在 Java 1.8 中找不到任何示例来完成此操作。有人可以和我分享一个吗?