You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

recoverData.m 1.0 kB

8 years ago
12345678910111213141516171819202122232425262728
  1. function X_rec = recoverData(Z, U, K)
  2. %RECOVERDATA Recovers an approximation of the original data when using the
  3. %projected data
  4. % X_rec = RECOVERDATA(Z, U, K) recovers an approximation the
  5. % original data that has been reduced to K dimensions. It returns the
  6. % approximate reconstruction in X_rec.
  7. %
  8. % You need to return the following variables correctly.
  9. X_rec = zeros(size(Z, 1), size(U, 1));
  10. % ====================== YOUR CODE HERE ======================
  11. % Instructions: Compute the approximation of the data by projecting back
  12. % onto the original space using the top K eigenvectors in U.
  13. %
  14. % For the i-th example Z(i,:), the (approximate)
  15. % recovered data for dimension j is given as follows:
  16. % v = Z(i, :)';
  17. % recovered_j = v' * U(j, 1:K)';
  18. %
  19. % Notice that U(j, 1:K) is a row vector.
  20. %
  21. X_rec = Z * U(:,1:K)';
  22. % =============================================================
  23. end

机器学习

Contributors (1)