简体   繁体   English

如何从python文件的命令行运行属性选择WEKA库?

[英]How can I run the attribute selection WEKA library from command line in a python file?

I follow the below structure to convert a csv file into an arff file, and it works. 我按照以下结构将csv文件转换为arff文件,并且它可以工作。 But for running the attribute selection library from WEKA it does not work. 但是对于从WEKA运行属性选择库,它不起作用。 Does anyone know? 有人知道吗?

 java -cp ~/weka.jar weka.attributeSelection.CfsSubsetEval 1 -E 1  "weka.attributeSelection.BestFirst -D 1 -N 5" -i ~/file.arff

I also tried the flooring command: 我还尝试了flooring命令:

java -cp ~/somewher/weka.jar weka.attributeSelection.InfoGainAttributeEval "weka.attributeSelection.Ranker -T -1.7976931348623157E308 -N -1" last -c -I ~/somewher/file.arff

But it gives me this error: 但这给了我这个错误:

java.lang.Exception: 
No training file given.

General options:
-h display this help
-i <name of input file>
Sets training file.
-c <class index>
    Sets the class index for supervised attribute
    selection. Default=last column.

I'm aware that I'm answering an old question, but the correct way to call Weka to select features is like this: 我知道我在回答一个老问题,但是调用Weka选择功能的正确方法是这样的:

java weka.filters.supervised.attribute.AttributeSelection -E weka.attributeSelection.CfsSubsetEval -S "weka.attributeSelection.BestFirst -D 1 -N 5"  -i input.arff  -o output.arff

(also this is not related to Python) (这也与Python无关)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM