Cannot use a simple RF model trained on the Iris dataset #168
codepictor
started this conversation in
General
Replies: 3 comments 7 replies
-
Hi, @codepictor! Could you send us this model file, please? |
Beta Was this translation helpful? Give feedback.
3 replies
-
Hi @cupertank, |
Beta Was this translation helpful? Give feedback.
1 reply
-
Hi @TimurReDoctor! |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello!
First of all, thank you for developing this really promising tool!
I have studied the examples in the separate repo: https://github.com/JetBrains-Research/kinference-examples. Now I would like to run
RandomForestClassifier
trained on the Iris dataset, as demonstrated in the following ONNX tutorial: https://onnx.ai/sklearn-onnx/index.html. This code successfully produces the file called "rf_iris.onnx".Then, I try to run "rf_iris.onnx" in Kotlin with the help of KInference (KIEngine is used to load the model):
val input = FloatNDArray(shape=intArrayOf(1, 4)) { it.toFloat() }
val output = runBlocking { model.predict(listOf(input.asTensor("X"))) }
However, I get
ArrayIndexOutOfBoundsException
:Index 2280 out of bounds for length 2277
java.lang.ArrayIndexOutOfBoundsException: Index 2280 out of bounds for length 2277
at io.kinference.trees.Sum.accept(Aggregator.kt:27)
at io.kinference.trees.SingleModeTreeEnsemble.applyEntry(SingleModeTreeEnsemble.kt:30)
at io.kinference.trees.SingleModeTreeEnsemble.applyEntry$default(SingleModeTreeEnsemble.kt:19)
at io.kinference.core.operators.ml.trees.KICoreTreeEnsemble.execute(KICoreTreeEnsemble.kt:40)
at io.kinference.core.operators.ml.TreeEnsembleClassifierVer1.apply(TreeEnsembleClassifier.kt:132)
at io.kinference.operator.Operator.applyWithCheck(Operator.kt:174)
at io.kinference.graph.Graph$execute$3$1.invokeSuspend(Graph.kt:224)
at io.kinference.graph.Graph$execute$3$1.invoke(Graph.kt)
at io.kinference.graph.Graph$execute$3$1.invoke(Graph.kt)
at io.kinference.profiler.ProfilingContextKt.profile(ProfilingContext.kt:26)
at io.kinference.graph.Graph$execute$3.invokeSuspend(Graph.kt:223)
at io.kinference.graph.Graph$execute$3.invoke(Graph.kt)
at io.kinference.graph.Graph$execute$3.invoke(Graph.kt)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:78)
at kotlinx.coroutines.CoroutineScopeKt.coroutineScope(CoroutineScope.kt:264)
at io.kinference.graph.Graph.execute(Graph.kt:220)
at io.kinference.core.model.KIModel.predict(KIModel.kt:22)
at io.kinference.model.Model$DefaultImpls.predict$default(Model.kt:18)
...
at _COROUTINE.BOUNDARY.(CoroutineDebugging.kt:46)
at io.kinference.graph.Graph.execute(Graph.kt:220)
at io.kinference.core.model.KIModel.predict(KIModel.kt:22)
Could you take a look what is going wrong, please?
Would be glad to hear any feedback. Thanks!
Beta Was this translation helpful? Give feedback.
All reactions