1
0
Fork 0

Recover data

master
neingeist 10 years ago
parent 798f82ecc1
commit beb652a5be

@ -1,7 +1,7 @@
function X_rec = recoverData(Z, U, K)
%RECOVERDATA Recovers an approximation of the original data when using the
%RECOVERDATA Recovers an approximation of the original data when using the
%projected data
% X_rec = RECOVERDATA(Z, U, K) recovers an approximation the
% X_rec = RECOVERDATA(Z, U, K) recovers an approximation the
% original data that has been reduced to K dimensions. It returns the
% approximate reconstruction in X_rec.
%
@ -19,9 +19,17 @@ X_rec = zeros(size(Z, 1), size(U, 1));
% recovered_j = v' * U(j, 1:K)';
%
% Notice that U(j, 1:K) is a row vector.
%
%
U_reduce = U(:, 1:K);
for i = 1:size(Z, 1)
z = Z(i, :)';
x_rec = z' * U_reduce';
X_rec(i, :) = x_rec;
end
% =============================================================