Getting error after compile classifiers using decision tree and treeBagger to Java

5 views (last 30 days)
I build two classifiers one use classificationTree and one uses treeBagger. Runing the .m file using both models in Matlab environment, I'm able to predict test data without problem. But after compile to Java .JAR library, I got error for both models. See below for my code to apply the model on test data and followed by error messages.
I'm running on Matlab R2011a. Here attached is the Matlab version info and a picture showing the toolbox in the JAR file created, which shows component of the stat toolbox is available. Also attach two models I created.
Please help troubleshoot why the compiled version doesn't work. Thanks.
%#function ClassificationTree
%#function TreeBagger
switch lower(modelInfo.modelType)
case 'decisiontree'
pred = predict(model,dn);
case 'treeBagger'
pred = predict(model,dn);
pred = str2num(cell2mat(pred));
Decision Tree model gives the same error:
{??? Undefined function or method 'classregtreeEval' for input arguments of type 'cell'. Error in ==> classregtree.eval at 90
Error in ==> CompactClassificationTree>CompactClassificationTree.predict at 485
The treeBagger model gives similar error: {??? Undefined function or method 'classregtreeEval' for input arguments of type 'cell'.
Error in ==> classregtree.eval at 90
Error in ==> CompactTreeBagger.CompactTreeBagger>CompactTreeBagger.treeEval at 1153
Error in ==> CompactTreeBagger.CompactTreeBagger>CompactTreeBagger.predictAccum at 1399
Error in ==> CompactTreeBagger.CompactTreeBagger>CompactTreeBagger.predict at 264
Error in ==> TreeBagger.TreeBagger>TreeBagger.predict at 1461

Answers (1)

Ilya on 9 Oct 2014
classregtreeEval is a mex function. I don't know what you need to do to use it in your jar library. But you can find a compiled mex for your platform in matlab/toolbox/stats/stats/@classregtree/private/
Ilya on 10 Oct 2014
I don't know if you are right about the cross-platform issue, but I am not an expert on jar's. No, you have to use this mex function to make predictions.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!