- Data Standardization: Ensure that XData is standardized if you are manually computing scores. The discrepancy can arise if XData is not centered and scaled.
- Coefficient Transformation: The transformation inv(diag(std(XData)))*wcoeff is unnecessary if you are using pca directly, as coeff is already orthonormal.
- Variable Naming: Ensure that wcoeff is correctly defined if you are using it separately. It seems you intended to use coeff.
Principal component Analysis example on Matlab
8 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I think there is something wrong here. I am applying the PCA through the statistical tool. I have a data XData that range from 1-0.9 with 512 dimension. I am using the PCA to reduce the dimension. I was following the example on: http://www.mathworks.com/help/stats/feature-transformation.html#f75476
I have applied : [coeff,score,latent] = pca(XData);
Then to transform the coefficients so they are orthonormal :
coefforth = inv(diag(std(XData)))*wcoeff;
when I test the data using : cscores = zscore(XData)*coefforth;
I can see that cscores and score are both different. Note that I didn’t need to wight my data.
I have also tried with a new data set :
0 comentarios
Respuestas (1)
arushi
el 26 de Ag. de 2024
Hi Kamu,
It seems like you're trying to perform Principal Component Analysis (PCA) on your data using MATLAB and are encountering issues with transforming the coefficients to be orthonormal.Here are some things you may check:
Hope this helps.
1 comentario
Image Analyst
el 26 de Ag. de 2024
It looks like pca has an option 'Centered', and the option is turned on by default. This will center the data columns about the mean for each column. You can turn it off if you want. It does not appear to do scaling so if your data had wildly different value ranges, then you'd want to scale them all to the same range, like 0-1, using rescale after you manually center them by subtracting the mean. If you're manually centering and scaling the data, you'd want the 'Centered' option to be off since it's already centered.
help pca
Ver también
Categorías
Más información sobre Dimensionality Reduction and Feature Extraction en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!