필터 지우기
필터 지우기

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

조회 수: 1 (최근 30일)
LiJie Yu
LiJie Yu 2014년 10월 9일
댓글: Ilya 2014년 10월 10일
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

답변 (1개)

Ilya
Ilya 2014년 10월 9일
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
LiJie Yu
LiJie Yu 2014년 10월 10일
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 2014년 10월 10일
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.

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by