Principle component Analysis in SNAP

Hi,

The same issue when performing PCA analysis occurred to me as well. I have not figured out what the problem is. Someone else might have the answer

Hi Marpet. Would you recomend to use other softwares instead of SNAP becouse of the abscence of PCA documentation?

No, I wouldn’t. As far as I know, it works quite well as long as you know what to do.

PCA is running well but I did not find out the eigenvector matrix to evaluate the PCA results.

PCA has strong dependency on scene area/statistics and bands context (all or selective sensor bands like indicated by the print screen B2, B3, B11, B12). So, we need all statistics like covariance or correlative matrix (standardized PCA), cumulative covariance, eigenvalues and eigenvectors matrix to made possible evaluate the results.

I suppose that we could organize the matrix based on “basis vector” but this is not secure because there is not a clear algorithim ordenance/linking of entry bands and components products

I strangely get a message: SVD Failed.

Am applying it to GLCM data.
Is there something I’m missing?
Should the data have actual HH/HV products as an i/p too apart from texture parameters?

Am I missing any basics?

have you checked if all bands look alright? Did you specifically select the input bands? Sometimes there are additional quality bands or cloud flags (Sentinel-2) which should not be included in the PCA.

Thanks for taking the time to respond Andreas.
I actually gave GLCM output (of 10 bands consisting of texture information) as an input for computing PCA -as I have read in one of the discussions here that PCA helps in reducing the no.of bands as well as keeps the important ones.
So definitely S2 is not the case here. May be, GLCM has few bands that function alike (eg, ASM & Energy), Is that the issue? Or this (PCA) cannot be applied on GLCM o/p?

if the GLCM bands look alright, you should be able to apply PCA to the product. Can you please visually check each of them if they contain valid data?
Also here, we should now focus in one topic - it makes sense to continue here: Sentinel-1 SNAP toolbox image view does not export as Geotiff with spatial reference - #17 by ABraun
If I had to do it, I would first geocode the data, then perform GLCM, then apply PCA.

Would you recomend to use other softwares instead of SNAP becouse of the abscence of PCA documentation?

not really, it works as it should and results will probably quite similar with other tools.

thanks for you quick reply, .

It is still very difficult to use PCA in the snap. the documentation needed to analyze the results is lacking. I tried everything that was suggested here on the forum, but you never have the eigenvalues ​​and eigenvectors that need to be reordered based on the variance/covariance matrix or the correlation matrix, as an option to choose between the two processes for the analyst. images/bands of great quality would give a multitude of possibilities for using techniques and bands such as FCPs, Crósta technique.

1 Like


this is an example of what needs to come out in the pca txt report - statistics and the matrix of var-covar or correl. we do not have to calculate nothing else but only analyze the matrix. the percentage of variance for each should come together and another topics is that we will never have negative values among PC1 values.

1 Like

This was not clear from your initial question.
You find the statistics in the metadata of the PCA product

It would help us a lot if you could post PCA with optical spectrum data as I did in the July 20th post and the latter. however on your print screen the components 1.1, 2.2, 3.3, 4.4 must be the diagonal of the matrix of variance/covariance or correlation, correct? in its component results - who are the input bands and what are the output components (row and column). in some software the column is the band and the line is the PC; in other programs, the opposite occurs. in the results I don’t find the values ​​of the variances or correlations. very important to visualize the structure of the data and the individual contribution positive or negative of each band to individual PCs.
in the title of your image we read “component_1”; what is it: 1.1, 1.2, 3.1 among the “Basis_Vector”?
doing lots of PDIs in SNAP would be far better than sharing tasks like PCA with others. I’m sorry if I’m being boring on this forum but I would like to understand the SNAP PCA outputs. maybe I do not know either how to use PCA.

Hi, there are many open source softwares to run PCA. but I would like to suggest you SPRING DPI 32 and 64 bit, under Windows, Mac and Linux platform in portuguese, spanish english and french. Or TerraLib and Terraview 5.6.1, 64 bit.

I’m not sure either, maybe @marpet or @lveci can clarify what these lists represent.

With a multi-spectral image as an input, this is the result

grateful for the print screen. assuming now that the “MEAN VECTORS” values ​​represent the variances of each band B2, B3, …, …, B12, let’s see then that the largest variance comes from the NIR band - 2579.5798 (compatible with radiance levels in the SWIR region and with the B8 bandwidth of 12 nm). now, how to assemble the matrix from the “Basis Vector” to find the contribution of each band for each main component image PC1, …, PCn. we need to have the output matrix structure. let’s see now in the window “product explorer” of my print screen (you can see in yours) that we have: “component_1 (490 nm)”. it can not. pcs are weighted linear combinations of all process bands and therefore have no reference to any single band.

1 Like