Generating function handles with large numbers of variable coefficients
이전 댓글 표시
I've come across a number of types of optimization process which require a parameter search in a high-dimensional space where the number of coefficients to be fit is based on a dataset.
Example: performing PCA on a set of 4k images. The SVD method does not work because the matrix would be ~8 petabytes.
In this context one normalizes each picture, subtracts their average, and renormalizes these difference images. Those images are eigenvectors. One then maximizes the function
sum(a(n)*I(n)).^2
such that
sum(a(n).^2)=1
This requires a function handle of the type
y = @(b,I) b(1)*I(:,:,1)+b(2)*I(:,:,2)+ .. +b(n)*I(:,:,n);
Along with the function to be minimized,
OLS = @(b) (2-sum(sum((y(b)))).^2); % Minimize this to maximize norm(y(b))
Currently i need to write 'y' out explicitly.
Now the question: is there a way to express this in terms of matrix multiplication without explicitly writing it out?
Thank you,
Matt
댓글 수: 4
So you are trying to find the maximum singular value/vector of the matrix
A=reshape(I,[],n);
but A cannot be stored in RAM? How big is n and what is size(I)?
Matthew Reed
2019년 5월 23일
편집: Matthew Reed
2019년 5월 23일
Matthew Reed
2019년 5월 23일
편집: Matthew Reed
2019년 5월 23일
채택된 답변
추가 답변 (1개)
I think this is what you want, but am still not totally sure. The way to calculate a sum of scalar/matrix products without explicitly writing out all n terms (if that's the question) would be,
function y=linearOp(b,I)
[p,q,n]=size(I);
y=reshape(I,[],n)*b(:);
y=reshape(y,p,q);
end
카테고리
도움말 센터 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!