필터 지우기
필터 지우기

Truncated SVD returns unexpected 1*1 result

조회 수: 5 (최근 30일)
Christopher McCausland
Christopher McCausland 2022년 1월 28일
댓글: Christopher McCausland 2022년 1월 30일
Hi,
I am currently prefoming SVD on six channels varying in time of the same type of biometric data. The recorded channels are similar as therefore they feature high correlation.
I want to take these six channels and reduce them to a single channel using SVD, I take my data, rescale it and then preform the svd, so far so good. Where I run into problems is the reconstruction. If I want the orignal data X = U*S*V '.Instead I am trying to preform a truncation by only taking the first PC as this accounts for over 95% of the information anyways.
Instead of PC1 returning a vector (1 channel * given number of samples) I am returned a single value (1*1). I am assuming I have a matrix the wrong way around but I can't see how I am getting this result (Though I know that I am the likely problem). I will attach some open source data too.
data = rescale(data(1:6,:),0,1); % Rescale the data for reobustness between patients
[U,S,V] = svd(data(:,:),'econ'); % Preform SVD
PC1 = V(:,1)'*data(1,:)'; % Atempt to eqivilent single channel
I also know I can compute something similar with the code below, but I would just really like to know where I am going wrong now!
[coeff,score,latent] = pca(data');
new_matrix_for_classification = score(:,1);
Thank you,
Christopher

채택된 답변

Matt J
Matt J 2022년 1월 28일
편집: Matt J 2022년 1월 28일
Well, you're multiplying a row vector by a column vector, so a scalar is the only result that is possible.
Shouldn't a 1-component reconstruction be,
PC1=data*V(:,1);
  댓글 수: 5
Matt J
Matt J 2022년 1월 29일
I have tried to move around the order of the data and V array and transpose them too but am still left with a 1*6 output
If you did, you should have gotten a 10000x1 output, as below.
data=rand(1e4,6);
[U,S,V] = svd(data,'econ'); % Preform SVD
PC1=data*V(:,1);
whos PC1
Name Size Bytes Class Attributes PC1 10000x1 80000 double
Christopher McCausland
Christopher McCausland 2022년 1월 30일
Hi Matt,
Thank you so much! I had forgotten to remove the additional transpose in my third line. So I was transposing the data back to its orignal orientation. This is now working as I would expect, thank you!!
One additional thing that cropped up is a large negitive DC offset was added to the waveform, I can remove this with DSP techniques (which is what I am much more comfortable with), however I was wondering if you had any idea for what would cause such a shift post svd processing? (Probably) more out of intrest than usefulness.
Thank you again for all your help!
Christopher

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Eigenvalues에 대해 자세히 알아보기

태그

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by