Weka从命令行预测CSV [英] Weka predictions to CSV from command line

查看:593
本文介绍了Weka从命令行预测CSV的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这与以下问题类似:我们预测为CSV ,但从命令行

This is similar to this question: Weka Predictions to CSV, but from the command line.

我有以下Weka命令:

I have the following Weka command:

java -Xmx10G weka.classifiers.meta.FilteredClassifier \
-t test_data.arff -d  prediction.model -p first -no-cv \
-F "weka.filters.unsupervised.attribute.Remove -R 1" \
-W hr.irb.fastRandomForest.FastRandomForest \
-- -I 512 -K 0 -S 512

其中给出以下数据:

=== Predictions on training data ===

inst#     actual  predicted error prediction (primary_key)
 1        1:0        1:0       0.996 (r153)
 2        1:0        1:0       0.994 (r756)
 3        1:0        1:0       0.97  (r23)
 4        1:0        1:0       0.995 (r18153)
 5        1:0        1:0       0.947 (r2691)

这是非常好的,但我想将此数据输出到CSV文件,以便轻松加载到数据库中。我如何告诉Weka我想要CSV输出我的预测?

This is great, but I would like to output this data to a CSV file for easy loading into a database. How do I tell Weka that I would like a CSV export of my predictions?

注意:使用Weka 3.6.6版

Note: using Weka version 3.6.6

推荐答案

这对我有用:

java -Xmx28G weka.Run -no-scan weka.classifiers.meta.FilteredClassifier \
-classifications "weka.classifiers.evaluation.output.prediction.CSV -p first" \
-l $model \
-T $dataset \
|tail -n+6 |head -n -1
#note: |tail -n+6  <-- removes the header of file
#      |head -n -1 <-- removes the footer of file

我必须升级到Weka 3.7.9才能使其工作。

I had to upgrade to Weka 3.7.9 to get this to work.

这篇关于Weka从命令行预测CSV的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆