Deploytool not including toolbox dependencies
2 views (last 30 days)
Show older comments
I'm using deploytool to make a standalone executable from some scripts and functions. The original code runs fine. I can also get the executable running - as long as I comment out two lines in the original code that call two toolbox functions, 'predict' and 'fitcnb'. These functions are in the statistics and system identification toolboxes.
Unlike all the other non-toolbox scripts, 'predict' and 'fitcnb' are not included in the "Files required for this application to run" in deploytool (not to mention any of their dependencies). Therefore it looks like deploytool is missing dependencies from these toolboxes.
How do I fix this? One way would be to manually add 'predict' and 'fitcnb' in deploytool. However they each have quite a few dependencies, so I'm wondering if there's an automated way.
Also, I'm new to using deploytool, so I'm not 100% sure my understanding of the problem is correct.
Edit: As requested, here are snippets of how I call 'predict' and 'fitcnb'. They're called from a custom function 'scorenb' which is called by a master script.
% master script
% ... (many lines skipped)
[scoreMatrix, feats_new] = scorenb(DistList,possList,classList);
function [score,feats] = scorenb(Dist2,possibleInts,TP_Matrix)
% ... (many lines skipped)
for iter = 1:Nmodel
% Fit Naive Bayes model
nab = fitcnb(Xtr(:,f2consider),ytr);
[~,scoretmp] = predict(nab,Xnew(:,f2consider));
end
Note that there are other functions called from 'scorenb' (i.e. the function calling 'predict' and 'fitcnb') that are automatically included by deploytool.
Edit 2: I tried manually including the entire toolboxes, but this gave me an error.
Edit 3: From documentation in stats/classreg/+classreg/+learning/FitTemplate.m, it seems like some function handles are created by str2func and cannot be resolved at compilation. I tried including those listed in FitTemplate.m but that didn't resolve my issue. Maybe there are more?
1 Comment
Steven Lord
on 7 Apr 2017
Can you show a small section of code that demonstrates how you're calling predict and fitcnb? In particular, how are you creating the variables that you use as inputs to those functions?
Answers (0)
See Also
Categories
Find more on Naive Bayes 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!