Update convergence checking in cp_als to be more efficient
Current code is...
iprod = sum(sum(P.U{dimorder(end)} .* U_mttkrp) .* lambda');
if normX == 0
fit = norm(P)^2 - 2 * iprod;
else
normresidual = sqrt( normX^2 + norm(P)^2 - 2 * iprod );
fit = 1 - (normresidual / normX); %fraction explained by model
end
fitchange = abs(fitold - fit);
Should be able to compute iprod
using purely matrix-matrix and matrix-vector operations.
Should also be able to compute norm(P)^2
from UtU
.
Edited by Tammy Kolda