Increase heap to avoid Out of Memory Error in WEKA

你。 提交于 2019-12-18 08:46:31

问题


I am trying to run a classifier in WEKA, using a J48 classifier using the following command line:

$ java -Xmx2048m -cp /home/weka-3-7-9/weka.jar weka.classifiers.trees.J48 -t input.arff -i -k -d J48-data.model &

Although the size of my arff is 43.8 M, and I aumented the heap space to 2048m, I still received the following errors:

Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
    at java.util.ArrayList.<init>(ArrayList.java:132)
    at weka.core.Instances.initialize(Instances.java:196)
    at weka.core.Instances.<init>(Instances.java:177)
    at weka.classifiers.trees.j48.ClassifierSplitModel.split(ClassifierSplitModel.java:252)
    at weka.classifiers.trees.j48.ClassifierTree.buildTree(ClassifierTree.java:159)
    at weka.classifiers.trees.j48.C45PruneableClassifierTree.buildClassifier(C45PruneableClassifierTree.java:126)
    at weka.classifiers.trees.J48.buildClassifier(J48.java:249)
    at weka.classifiers.evaluation.Evaluation.evaluateModel(Evaluation.java:1485)
    at weka.classifiers.Evaluation.evaluateModel(Evaluation.java:649)
    at weka.classifiers.AbstractClassifier.runClassifier(AbstractClassifier.java:297)
    at weka.classifiers.trees.J48.main(J48.java:1062)

Does someone know if I am doing something incorrectly? Or can point me to a different solution to increase the heap?

Thank you in advance.


回答1:


Quick instruction for the Ubuntu-Users: The heap can be set by changing the line MEMORY="256m" in the file /usr/bin/weka with your favored editor.




回答2:


Weka's instructions state that the "-Xmx..." command will not work from the simple command line interface. I believe you should increase the heap size by editing the RunWeka.ini file. The link I provided should point you in the right direction.




回答3:


In terminal use this command

sudo gedit /usr/bin/weka

Change the size in the line

MEMORY="256m"



来源:https://stackoverflow.com/questions/19067449/increase-heap-to-avoid-out-of-memory-error-in-weka

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!