- 'pca' function: https://www.mathworks.com/help/stats/pca.html
- Sample Data Sets: https://in.mathworks.com/help/stats/sample-data-sets.html
After PCA, ALS method, use coefficients to reproduce decomposition
6 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I have a matrix A with 100 rows (trials) and 64 columns (variables). This matrix contains NaN values.
I am using the syntax:
[coeff,score] = pca(A,'algorithm','als');
This produces coeff, which is 64 x 64, and score, which is 100 x 64.
I then have a second matrix, B, which is 100 x 64. B also contains NaNs.
Usually, I could do:
score_b = B * coeff
However, this just produces a matrix full of NaNs. It doesn't work because of the NaN values in B. How do I recreate the effect of doing PCA, ALS algorithm, on B?
For instance, I can do as follows, but it doesn't seem as elegant.
[~,score] = pca([A;B],'algorithm','als')
score_b = score(101:200,:)
0 Commenti
Risposte (1)
Balavignesh
il 4 Ott 2023
Hi Joshua,
As per my understanding, you would like to find 'score_b' for a matrix 'B' by using 'PCA' score of matrix 'A', which has 'NaN' values.
However, applying the 'PCA' to matrix 'A' resulted in a 'score' and 'coeff' which are 'NaN'.
I would suggest you apply 'PCA' to some legitimate dataset to get valid results.
Here is an example code that could help you understand this:
% This is an example dataset. Input your own dataset
load hald.mat
ingredients
[coeff , score] = pca(ingredients,'Algorithm','als')
Please refer to the following documentation links to have more information on:
Hope that helps!
Balavignesh
0 Commenti
Vedere anche
Categorie
Scopri di più su Dimensionality Reduction and Feature Extraction in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!