How to explicitly specify in clojure when interacting with java

In an attempt to use weka from clojure, I am trying to convert this howto guide from wka wiki to clojure using java interop clojure functions.

This has worked well so far, except in one case where the clojure reflection mechanism cannot find the correct method to call - I have:

(def c-model (doto (NaiveBayes.) (.buildClassifier is-training-set)))

This will later be called by the .evaluateModelclass method Evaluation:

(.evaluateModel e-test c-model is-testing-set)

where e-testis of type weka.classifiers.Evaluationand, according to their api documentation , the method takes two type parameters ClassifierandInstances

What I get from clojure, although there is IllegalArgumentException No matching method found: evaluateModel for class weka.classifiers.Evaluation clojure.lang.Reflector.invokeMatchingMethod (Reflector.java:53)- I assume that it is because it c-modelhas a type NaiveBayes, although it should also be Classifier- which it is, according to instance?.

cast , , , (, , ), clojure. clojure, java interop? ( , , , NaiveBayes Classifier)

:/http://paste.lisp.org/display/129250

+5
2

javadoc , , - , , , . SO (, , ?), Clojure varargs, , javac. JVM Object []. , , .

+6

IllegalArgumentException No matching method found , . , - . .

repl-utils/show

+2

All Articles