次の方法で Vowpal Wabbit を実行する Java コードを作成しました。
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=ロジスティック -f model.vw
これの欠点は、ディスクへの書き込みが必要になることです。いくつか検索した後、vowpal wabbit が R の標準入力の例からのデータの読み取りをサポートしていることを知りました
Java 1.8 でこれを実現する例は見つかりませんでした。誰か私と共有できますか?