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

1 visualización (últimos 30 días)
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
model=modelInfo.model;
switch lower(modelInfo.modelType)
case 'decisiontree'
pred = predict(model,dn);
modelFound=2;
case 'treeBagger'
pred = predict(model,dn);
pred = str2num(cell2mat(pred));
end
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

Respuestas (1)

Ilya
Ilya el 9 de Oct. de 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/
  2 comentarios
LiJie Yu
LiJie Yu el 10 de Oct. de 2014
Thanks for the reply. I build the JAR in Windows platform, but need to deploy it to run in Hadoop Linux environment. So with this platform dependent .mex function it wouldn't work then. Is there a way to build classificationTree/bagged tree ensemble models without using the .mex function? Right now I'm using the ClassificationTree and TreeBagger from stats toolbox.
Ilya
Ilya el 10 de Oct. de 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.

Iniciar sesión para comentar.

Community Treasure Hunt

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

Start Hunting!

Translated by