owwoow14
owwoow14

Reputation: 1754

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.

Upvotes: 5

Views: 12340

Answers (3)

gocen
gocen

Reputation: 103

In terminal use this command

sudo gedit /usr/bin/weka

Change the size in the line

MEMORY="256m"

Upvotes: 1

aldorado
aldorado

Reputation: 4844

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.

Upvotes: 14

Walter
Walter

Reputation: 2811

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.

Upvotes: 2

Related Questions