필터 지우기
필터 지우기

memory pca vs pcacov

조회 수: 5 (최근 30일)
Hans van der Horn
Hans van der Horn 2020년 11월 2일
댓글: Hans van der Horn 2020년 11월 2일
Dear all,
I'm running a pca on a large matrix (33*500,000) and with pcacov I get a memory error, but pca gives me no trouble. Could anyone explain this to me? Is the matrix somehow being reduced before computing the covariance matrix in pca?
Thanks!
Best
Hans

답변 (3개)

Hiro Yoshino
Hiro Yoshino 2020년 11월 2일
In PCA, your matrix (p x q) will be once converted into the variance-covariance matrix (q x q).
This would reqiure huge memory comsumption. Meanwhile, pcacov accepts a variance-covariance matrix as an input and, therefore the argument (input) should be a square matrix though.
As for big data anaysis, you may want to use tall array - this can be a solution.

Hans van der Horn
Hans van der Horn 2020년 11월 2일
Dear Hiro,
Thanks for your answer. If I compute cov(my matrix) to get the input for pcacov I run out of memory. However, if I run the pca function on my matrix. Why does the pca.m not get into memory problems?
Best
Hans
  댓글 수: 2
Hans van der Horn
Hans van der Horn 2020년 11월 2일
*sorry, something was missing 'However, when I run the pca function on my matrix, it goes well. Why does pca.m not get into memory problems?'
Thanks
Hiro Yoshino
Hiro Yoshino 2020년 11월 2일
I do not believe pcacov works with your matrix in the first place since the shape of your matrix is unacceptable. I do not know what the error will be like.

댓글을 달려면 로그인하십시오.


Hans van der Horn
Hans van der Horn 2020년 11월 2일
Dear Hiro,
The problem is that by constructing the covariance matrix Matlab runs out of memory. Why does the pca.m function not give memory problems (when I of course enter the original matrix)?
thanks!
  댓글 수: 2
Hiro Yoshino
Hiro Yoshino 2020년 11월 2일
I got your point now!!
OK, actually to avoid memory problem, pca normally takes a different approach to calculate eigen vectors - SVD. This is not a direct method and produces some by-product. This is a well-known fact - you may find the this in your text book too, I'm sure.
Also, the documentation for PCA reads it uses SVD.
Hans van der Horn
Hans van der Horn 2020년 11월 2일
thanks! It's clear to me now:) I will also read the documentation for PCA (I thought pcacov also used svd..).

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Dimensionality Reduction and Feature Extraction에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by