Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Increase heap to avoid Out of Memory Error in WEKA

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.

like image 671
owwoow14 Avatar asked Sep 28 '13 13:09

owwoow14


3 Answers

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.

like image 112
aldorado Avatar answered Nov 18 '22 11:11

aldorado


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.

like image 29
Walter Avatar answered Nov 18 '22 12:11

Walter


In terminal use this command

sudo gedit /usr/bin/weka

Change the size in the line

MEMORY="256m"

like image 1
gocen Avatar answered Nov 18 '22 10:11

gocen