2
(defn weka-feature-reduce [in out]
  (sh "java" "-cp" "/Applications/weka-3-7-13/weka.jar"
  "weka.filters.supervised.attribute.AttributeSelection"
  "-E" "weka.attributeSelection.InfoGainAttributeEval"
  "-S" "weka.attributeSelection.Ranker -N 300"  
  "-i" in "-o" out "-c" "1"))

I have this clojure function to that takes a .csv file and processes it to an .arff file. this fucntion used to work back in the day but currently it gives an error which is;

{:Exit 0, :out "", :err "java.io.IOException: Read unknown nominal value selamfor attribute :training-for (line: 102). Try increasing the size of the memory buffer (-B option) or explicitly specify legal nominal values>with the -L option.\n\tweka.core.converters.CSVLoader.makeInstance(CSVLoader.java:1013)\n\tweka.core.converters.CSVLoader.getNextInstance(CSVLoader.java:839)\n\tweka.core.converters.ConverterUtils$DataSource.hasMoreElements(ConverterUtils.java:375)\n\tweka.filters.Filter.filterFile(Filter.java:1104)\n\tweka.filters.Filter.runFilter(Filter.java:1372)\n\tweka.filters.supervised.attribute.AttributeSelection.main(AttributeSelection.java:614)\n\n\tat weka.core.converters.CSVLoader.makeInstance(CSVLoader.java:1013)\n\tat weka.core.converters.CSVLoader.getNextInstance(CSVLoader.java:839)\n\tat weka.core.converters.ConverterUtils$DataSource.hasMoreElements(ConverterUtils.java:375)\n\tat weka.filters.Filter.filterFile(Filter.java:1104)\n\tat weka.filters.Filter.runFilter(Filter.java:1372)\n\tat weka.filters.supervised.attribute.AttributeSelection.main(AttributeSelection.java:614)\n"}

how can i fix this? thanks in advance. I use mac osx yosemite.

tolga
  • 51
  • 2
  • 1
    In the `:err` key you got an explicit error message and hint how to fix it: `java.io.IOException: Read unknown nominal value selamfor attribute :training-for (line: 102). Try increasing the size of the memory buffer (-B option) or explicitly specify legal nominal values>with the -L option.`. Did you try them? – Piotrek Bzdyl Apr 06 '16 at 20:59
  • 1
    I increased the memory of JVM from project.clj but it did not worked. i found this [http://stackoverflow.com/questions/19067449/increase-heap-to-avoid-out-of-memory-error-in-weka]someone in the comment mentioned that there is a weka file which you can edit the memory. but i checked there was nothing(of weka) in my computer at there. Then i found this [http://stackoverflow.com/questions/9164638/weka-gui-not-enough-memory-wont-load] i did what Alina mentioned at there and changed the memory to 4G but still nothing – tolga Apr 06 '16 at 21:43

2 Answers2

0

In this case you are starting the JVM, and then running a clojure function that starts a shell, and that shell starts another different copy of the JVM and then runs a class in that.

You may find the integration easier if you add the weka jar to your classpath and then just run the appropriate method from within clojure by calling it directly.

The java parameters mentioned in that error message refer to the copy of java being started by the second shell, so if you really want to go that route, add those parameters adter "java" and before "-cp", though I think your life will be much more pleasant if you don't run a nested JVM and just call weka directly from clojure using java interop and these instructions

Arthur Ulfeldt
  • 90,827
  • 27
  • 201
  • 284
0

I think best and easiest approach is to convert the csv files into arff from within WEKA.
For 70 datasets it took me <5 minutes and you avoid having such issues in future.