How do I use the score function in Tensor Toolbox?
3 views (last 30 days)
Show older comments
Using cp_nmu from tensor toolbox, I am attempting to calculate similarity score between different fits of the model to the best fit, for different numbers of components, so that I can see a which number of components the similarity score between fits drops off:
function [scr]=similarity(M,j,min_err_index,n_fits)
%Find the fit with the least error out of all fits
M_best = M(min_err_index,1)
% For all combinations of fits
for n = 1:n_fits
% Calculate similarity score for each fit that is stored in M.
scr_v(j, n) = score(M(j,1).i, M_best);
end
% Delete the score between M_best and itself
scr_v(j,min_err_index) = []
% Output the largest similarity score between fits.
scr(j) = max(scr_v(j,:));
end
n_fits is how many fits there are, M is a structure of size (n_fits,1) containing the fits for the current number of components and j is the current number of components. min_err_index is the index of the fit in M with the least error.
I am struggling with this because when I run this, when I get to around 9 for the number of components, the size of the computation from the score function is so large that it the whole program fails, because the amount of storage required exceeds that of what MATLAB has. I think I'm doing something wrong, because the tensors that I am working with are quite small. Something like 20x200x300.
Any help would be greatly appreciated.
0 Comments
Answers (0)
See Also
Categories
Find more on Get Started with Statistics and Machine Learning Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!