Sale!

SVD rank

17

Description

Outputs a low rank approximation of a matrix and the residual. Useful for judging what the appropriate rank of your dataset is.

% Performs SVD on matrix A and outputs the rank r'th approximation as A_r
% The residual data R = A - A_r is also an output.
function [A_r,R] = svdrank(A,r)
[U,S,V] = svd(A);
A_r = U(:,1:r)*S(1:r,1:r)*V(:,1:r)';
R = A - A_r;
figure();
imagesc(A_r);
title(['Rank ' num2str(r) ' Approximation']);
figure();
imagesc(R);
title(['Rank ' num2str(r) ' Residual']);
end

https://matlab1.com/shop/python-code/augmenting-the-dataset-in-tensorflow/

Reviews

There are no reviews yet.

Be the first to review “SVD rank”

Your email address will not be published. Required fields are marked *

Category: