ignite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kencottrell <ken.cottr...@gridgain.com>
Subject Random Forest, trying to evaluate accuracy but getting exception
Date Wed, 05 Feb 2020 21:29:15 GMT
I have attempted to add this call to a RandomForestModel in order to obtain
accuracy:

          *double accuracy = Evaluator.evaluate(
                    dataCache,
                    randomForestMdl,
                    vectorizer,
                    new Accuracy<>()
                );

                System.out.println("\n>>> Accuracy " + accuracy);
                System.out.println("\n>>> Test Error " + (1 - accuracy));*


But I get this exception (editted to remove extra detail). Am I using the
wrong parameters?

Exception in thread "main" java.lang.RuntimeException: class
/org.apache.ignite.ml.math.exceptions.IndexException: Invalid (out of bound)
index: 16
	at
org.apache.ignite.ml.selection.scoring.evaluator.Evaluator.calculateMetric(Evaluator.java:330)
	at
org.apache.ignite.ml.selection.scoring.evaluator.Evaluator.evaluate(Evaluator.java:57)
	at com.gg.TrainRandomForest2.main(TrainRandomForest2.java:111)
Caused by: class org.apache.ignite.ml.math.exceptions.IndexException:
Invalid (out of bound) index: 16
	at
org.apache.ignite.ml.math.primitives.vector.AbstractVector.checkIndex(AbstractVector.java:174)
	at
org.apache.ignite.ml.math.primitives.vector.AbstractVector.get(AbstractVector.java:179)
	at
org.apache.ignite.ml.tree.randomforest.data.TreeNode.predict(TreeNode.java:91)
	at
org.apache.ignite.ml.tree.randomforest.data.TreeNode.predict(TreeNode.java:92)
	at
org.apache.ignite.ml.tree.randomforest.data.TreeRoot.predict(TreeRoot.java:52)
	at
org.apache.ignite.ml.tree.randomforest.data.TreeRoot.predict(TreeRoot.java:29)
	at
org.apache.ignite.ml.composition.ModelsComposition.predict(ModelsComposition.java:64)
	at
org.apache.ignite.ml.composition.ModelsComposition.predict(ModelsComposition.java:32)
	at
org.apache.ignite.ml.selection.scoring.cursor.CacheBasedLabelPairCursor$TruthWithPredictionIterator.next(CacheBasedLabelPairCursor.java:145)
	at
org.apache.ignite.ml.selection.scoring.cursor.CacheBasedLabelPairCursor$TruthWithPredictionIterator.next(CacheBasedLabelPairCursor.java:121)
	at
org.apache.ignite.ml.selection.scoring.metric.classification.Accuracy.score(Accuracy.java:36)
	at
org.apache.ignite.ml.selection.scoring.evaluator.Evaluator.calculateMetric(Evaluator.java:328)
	... 2 more

/



--
Sent from: http://apache-ignite-developers.2346864.n4.nabble.com/

Mime
View raw message