# How to reduce dimensionality of a rectangular matrix

2 views (last 30 days)
Ritesh Chandra Tewari on 31 Mar 2023
Edited: John D'Errico on 31 Mar 2023
I have collected 288 radar data. The sampling frequency was 128khz. So we collected 5-second data, which gives us 640000 data points in 5 seconds. Now we form a matrix of 640000x288 and want to reduce the dimensionality to 6400x288. Which method is suitable? I tried to use PCA using svd method. But as principal component depends upon the lowest number between the row and column of the matrix. So maximum principal component I get is 288. but I want 6400. how to get that. I tried this, but not working:
clear all;
X = data.A;
X = real(X);
% Perform PCA along columns
[coeff, score, ~, ~, explained] = pca(X', 'Algorithm', 'svd');
% Choose number of top principal components to keep
k = 6400;
% Compute reduced data matrix
X_reduced = score(:, 1:k) * coeff(:, 1:k)';
% Save reduced data to file
dlmwrite('reduced_data.csv', X_reduced, 'delimiter', ',', 'precision', '%.8f');

John D'Errico on 31 Mar 2023
Edited: John D'Errico on 31 Mar 2023
Your matrix has size 640000 by 288. So there are only 288 pieces of distinct information in your data. You CANNOT use PCA to do this operation. And, even, to the extent that you could try to use a tool like PCA, the result would carry no meaning. You would get random looking trash.
However, that may not be what you were looking to do. It is not at all uncommon that people misunderstand what PCA does and how it works, or why you would want to use it.
For example, you may easily be just wanting to form the average every block of 100 elements of the original array. This is trivially done. And since this is an exactly 100:1 reduction, the amount of such a reduction seems a likely candidate for what you want to do.
x_reduced = squeeze(mean(reshape(x,100,6400,288),1));
Perhaps that is what you wanted to do. It makes sense, IF there is some sort of spatial relationship between the rows of x, so that rows of x near to each other are likely to be similar in behavior. And, since your data was simply sampled in time, and now you want a reduced time sample, then averaging every 100 elements makes perfect sense.
We cannot know of course, but PCA won't solve the problem you asked to solve (and again, the result of that PCA would be meaningless garbage, that would not look at all like your data.)

### Categories

Find more on Dimensionality Reduction and Feature Extraction in Help Center and File Exchange

R2022a

### Community Treasure Hunt

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

Start Hunting!