LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Re: principal component analysis in LabVIEW

Solved!
Go to solution

I want to do PCA of FFT of a data(signal with known amplitude and time).I am using labview 2009.I tried it using the inbuilt pca.vi ;but data size mismatch.I am studying PCA for the 1st time in my life.please help.i am doing my final year project on this.

Actually i have to feed the FFT output to a Neural Network.And i am doing PCA to reduce the dimensionality of the signal so that it can be fed to the Neural Network.

0 Kudos
Message 1 of 14
(6,503 Views)

i need to find the PCA of an acoustic signal which i have collected using the data acquisition system.how can i connect this signal to the TSA principal component Analysis.vi?For now i have stored the data as a 1-D  array of numbers.How can i do PCA on this array?please help.

0 Kudos
Message 2 of 14
(6,435 Views)
Solution
Accepted by topic author alkamohan

Hi,

 

The input for the TSA Principal Component Analysis (Array) VI is a 2D array where each column of the data represents the multivariate vector.

 

What exactly is that you are trying to achieve using the PCA vi?

 

If it is just the resulting PCA scores and weights. Then you may first want to identify the multivariate data in you acoustic signal thus forming a 2D array of data and not 1D array as pointed in you post.

 

If single element of the 1D array of the acoustic signal contains various vector, then you may want to acquire data over a period of time without any change in input parameters and then pass the resulting 2D array of data to the PCA.vi.

 

Hope this helps!

 

 

0 Kudos
Message 3 of 14
(6,428 Views)

What i actually need to do is that:  obtain readings from an accelerometer and then feed this signal,which is actually not apt to be fed to a neural network as such(so i have to reduce the dimensionality of the signal and this i aim to do using PCA).i need to train the data and obtain some useful result.

0 Kudos
Message 4 of 14
(6,404 Views)

I did something.but i am not sure whether this is right.Using the data that i have(samples and time ),i created a waveform using 'build waveform' and then from its output using 'build array' i created an array and fed it to the PCA.vi .is it right?

0 Kudos
Message 5 of 14
(6,395 Views)

Hi,

 

For

 

 a.  obtain readings from an accelerometer and then feed this signal,which is actually not apt to be fed to a neural network as such

         I really doubt if PCA could be used to reduce the dimensionality of the signal. PCA would return the set of linearly uncorrelated variables for the input of possibly correlated variables.

 

 b. i need to train the data and obtain some useful result

  You may want to do Principle Component Regression then, in which case you would need to form a Linear regression equation for the obtained Principle Component Scores and fit the Input variable (acceleration or as the case may be) to the output predicted values expected as input to the Neural network. This would definitely invovle vector operation (cross and dot product)

 

The blocks would be

 

Acquire Multidimensional Data >> Perform PCA >> Use result along with Reference Accelerometer Signal and General Linear fit to obtain Coefficients >> Use PCA weights and multiply cross product with Multidimensional Data >> Use Dot product along with Coefficients to return the predicted values. (sorry, could not find the time to create block digram and explain shall post the same if done)

 

 

Message 6 of 14
(6,393 Views)

@NaruF1 wrote:
         I really doubt if PCA could be used to reduce the dimensionality of the signal. PCA would return the set of linearly uncorrelated variables for the input of possibly correlated variables.

 

 



Hi NaruF1,

 

I think data reduction is one crucial point of PCA. Here's an example to clearify my point of view on this topic:

 

The input data is a 2d Array with 36 rows and 56 columns

 

1.png

 

 

Basically, a PCA algorithm decomposes this Array X into a structure part and

 a noise part.

 

Scores and loadings form the matrix product TP.

 

X = T1P1 + T2P2 + T3P3 + ... + Noise

 

 

If you just look at e.g. the first, second and third TP to define X there is less data to be taken into consideration:

 

The Output Array (without Noise) is a 2d Array with 3 rows and 56 columns

 

2.png

 

 

 

Those PCAs can be used to identify unlabeled data; one way of doing this would be regression as NaruF1 proposed.

 

 

 

 

 

 

 

 

Regards,

Alex


 

0 Kudos
Message 7 of 14
(6,366 Views)

Hai,

i have a signal output as attached below.i have taken its mean,variance alongwith the RMS values of its FFT.Now i need to minimise the data obtained,which is in the form of a 16x10 matrix so as to feed it to the Neural Network.thats where i need to implement PCA vi.How can i do it?

0 Kudos
Message 8 of 14
(6,339 Views)

Hi AlkaMohan,

 

When you pass the 16(Rows)*10(columns) Matrix data (2D array I believe) to the TSAPrincipleComponent Array vi, then the result Xt out  would contain the resulting PCA Scores whichwould be of same size 16*10, however, as pointed by alexderjuengere, we would be interested only in the scores where the variance is least. Which usually would be in resulting Xt out (column1and2 data ). (So now your PCA scores would contain 16*2 Data after performing delete array function)

 

1. You may need to form an Multinomial expansion with selectable order for the Resulting PCAScores, prior to performing Linear fit using General Linear Fit vi prior to returning the Coefficient Values.

 

2. Further to this, you would require to use the weight array from the TSAPrincipleComponent Array vi, and perform cross multiplication with you Input Acceleration data and Multinomial expasion function you would define.

 

3. The final setup would be to use the Resulting data from Step 2 and Perform Dot product with Coefficient obtained in Step1.

 

Like I have said before the method is not straight forward and you may need to keep watch on the row/columns of data being passed appropriately to individual function.

 

Regards.

0 Kudos
Message 9 of 14
(6,329 Views)

Thanx for helping me out.what i understood so far is that after getting the PCA output,i need to obtain a 16x2 array using delete array vi.after that whatam i supposed to do?could you spend some time to develop the steps ahead in labview and send me the block diagram.am so much under pressure right now.it would be a great help.

Download All
0 Kudos
Message 10 of 14
(6,319 Views)