Is there a known issue compiling the stats toolbox?

1 view (last 30 days)
Greg
Greg on 21 Apr 2017
Commented: Greg on 25 Apr 2017
We're compiling our code as a standalone program, and getting it working has been tricky. From trial and error, we've isolated the problem to a single call to a function in the statistics and machine learning toolbox ('fitcnb'). If I comment out this single line, the code compiles and the program runs; if I don't comment it out, the code compiles but crashes at runtime.
I've seen a couple other questions with issues when compiling the stats toolbox. (Question 1) (Question 2) The only resolution seems to be creating custom functions and avoiding the stats toolbox. This is fine if the functions are simple, but in our case it's a machine learning classifier, and I'd rather not re-write that.
From the current documentation, the stats toolbox is completely supported. However that doesn't seem to be the case. Is this either a known issue with the stats toolbox?
We're using Matlab 2016a, Matlab compiler 9, and OSx 10.11.3.
Edit: To reproduce the error on my machine, I do the following:
% compile the standalone
mcc -m callStatsToolbox.m
% attempt to run the standalone
!./run_callStatsToolbox.sh /Applications/MATLAB/MATLAB_Runtime/v901/
where callStatsToolbox.m is the following function:
function callStatsToolbox()
XX = rand(10^4,5); % make some random data
yy = rand(10^4,1)>0.5; % make random labels
naive_bayes_model = fitcnb(XX,yy);
[predicted_class, score] = predict(naive_bayes_model,XX);
disp('It worked!')
  4 Comments
Walter Roberson
Walter Roberson on 24 Apr 2017
I took the callStatsToolbox code you posted, and packaged it using Application Compiler, on OS-X El Capitan and R2017a. The only change I made was to convert the disp('It worked!') to a uiwait(msgbox('It worked!')) . There was no difficulty in the building or execution.
Greg
Greg on 25 Apr 2017
Thank you. I upgraded to Matlab 2017A and standalone runs fine. I'm not sure what the issue was, but upgrading seems to have fixed it!

Sign in to comment.

Answers (1)

Image Analyst
Image Analyst on 24 Apr 2017
Did you look in mccExcludedFiles.log?
Have you sent the crash log into the Mathworks? They will help you figure out what is crashing the app if you have a current maintenance contract with them.
  2 Comments
Greg
Greg on 24 Apr 2017
Edited: Greg on 24 Apr 2017
I re-checked mccExcludedFiles.log, and there are indeed extra excluded files for the crash-prone standalone. The files are both named 'pem_.m' and are in the Systems Identification (ident) toolbox, which is confusing becaue 'pem_' or 'pem' is never called from the stats toolbox!
However, 'pem' is called from 'advice.m' in the ident toolbox, which is the only command line function from the ident toolbox that can't be compiled. But again, I don't know why that would affect compiling 'fitcnb' from the stats toolbox...
Thanks for the link. The only thing I hadn't tried is contacting Mathworks, which I just did. They got back to me and asked for the crash report. I'll post any answer they give me.
Greg
Greg on 24 Apr 2017
Edited: Greg on 24 Apr 2017
To follow up - I thought the compiler might be getting confused by the call to 'predict', since 'predict.m' is a function in both the stats and ident toolboxes. So I replaced the call to 'predict' with '[predicted_class, score] = naive_bayes_model.predict(XX);'. This does not solve the error, but when I do it 'pem_.m' is no longer in mccExcludedFiles.log. That is, having 'pem_.m' in mccExcludedFiles.log is not required to reproduce the issue.

Sign in to comment.

Categories

Find more on Introduction to Installation and Licensing in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!