Getting error after compile classifiers using decision tree and treeBagger to Java
조회 수: 1 (최근 30일)
이전 댓글 표시
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
댓글 수: 0
답변 (1개)
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
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!