Fastica filter

Forum for discussion on different signal processing algorithms
Locked
Alberto88
Posts: 23
Joined: 04 May 2014, 09:22

Fastica filter

Post by Alberto88 » 26 May 2014, 06:13

hello, I'm supposed to implement a spatial filter FastICA and insert it into the code bci2000, can anyone help? would like to know what kind of input arrives at the spatial filter? SpatialFilter.cpp I tried to include in the library ApplicationBase.h but it always fails and so I can not use AppLogScreen to print me the type of input ....
you know you help me??

boulay
Posts: 382
Joined: 25 Dec 2011, 21:14

Re: Fastica filter

Post by boulay » 27 May 2014, 21:43

Start here and follow the instructions to create a new SignalProcessing module with a new filter.

Alberto88
Posts: 23
Joined: 04 May 2014, 09:22

Re: Fastica filter

Post by Alberto88 » 28 May 2014, 08:24

wanted to know if the signal input to the spatial filter is with or without white noise to later apply the filter FastICA
and i want insert the fastica inside a spatialfilter.cpp existing adding the function and other case with fullmatrix none sparsematrix and CAR

boulay
Posts: 382
Joined: 25 Dec 2011, 21:14

Re: Fastica filter

Post by boulay » 28 May 2014, 08:58

Alberto88 wrote:wanted to know if the signal input to the spatial filter is with or without white noise to later apply the filter FastICA
and i want insert the fastica inside a spatialfilter.cpp existing adding the function and other case with fullmatrix none sparsematrix and CAR
There is no added noise.

If you want to modify the spatialfilter then the best way to do it is to create both a new module and a new filter. The new filter will be called something like NewSpatialFilter, and its header and implementation files should be copy-pasted from spatialfilter then you should modify them accordingly. Then, for NewSignalProcessing you should copy a signalProcessing module that matches closely what you want to do but change the filter chain to use NewSpatialFilter instead of SpatialFilter.

However, I'm not sure that's the best way to accomplish what you want to do.

First, do you plan on having the ICA decomposition update in real-time? How long does it take to run the ICA?

If you do not plan to update the weights in real-time then you're better off calculating your weights off-line, using whatever tools you want, then parameterizing the full spatial filter with those weights.

If you want to update the weights in real time then how you go about it depends largely on whether or not you can expect the update to be calculated within the duration of one sample block (typically 25~100 msec). If it cannot (which I guess it cannot) then you'll have to do the calculation asynchronously. This is a lot more complicated than simply modifying the spatial filter.

Alberto88
Posts: 23
Joined: 04 May 2014, 09:22

Re: Fastica filter

Post by Alberto88 » 28 May 2014, 09:06

thank you very much for your reply, I do not know yet how long it takes the FastICA to calculate the weights, if it fails to calculate in real time, that is, under 100ms, I can not use it in a chain within the bci2000 correct?? whom Would you recommend me another filter is easy to implement in real time? mine is a thesis university where I have to implement something more to be included in bci2000

I ran a test of gtest for FastICA implemented by the library + + and it seems that in total the single test uses 31ms might be fine as long no?
help??

boulay
Posts: 382
Joined: 25 Dec 2011, 21:14

Re: Fastica filter

Post by boulay » 28 May 2014, 11:51

Yes. 31 ms should be fine. I'm very surprised it is that fast. How much data (channels x samples) were you using?

Does your FastICA library let you specify initial weights? If so, you could use many data to build an initial set offline (this may be slow), then use iterative/recursive updating of the weights within BCI2000.

As for other signal processing to implement, there are many possibilities. It really depends on the application. What would you like the BCI to do and how do you think the BCI can do it best?

Alberto88
Posts: 23
Joined: 04 May 2014, 09:22

Re: Fastica filter

Post by Alberto88 » 28 May 2014, 12:44

in the test sample library was used as a matrix 10000 x2 dataset, so they should be 2-channel 10000 samples in all ..... today was the first day that I was able to start the test so I could be wrong I'll know better ....

instead to other ideas my main problem is to find something, even already implemented in more than one present in bci2000 namely:
bci2000 has full spatial filters scattered CAR, I had thought of FastICA and CSP.
bci2000 has a linear classifier, I had thought of a SVM

But I would not go into things too difficult to implement and put into bci2000

beyond this where I intervene?'m sorry but you know that I am a little confused are many new things for me.

boulay
Posts: 382
Joined: 25 Dec 2011, 21:14

Re: Fastica filter

Post by boulay » 28 May 2014, 13:19

For ICA to be useful in EEG, you'll need at least 32 channels, and you'll probably need at least 2000 samples. I'm pretty sure any ICA is going to be slower than 31 ms when dealing with that many channels.

As for your other questions, ICA and CSP are just ways to calculate how sensors can be recombined, by weighting and summing, to extract more useful information. ICA and CSP are typically done offline then the weights are put into the spatial filter and not changed unless a subsequent offline calculation suggests new weights would work better.

Similarly, SVM finds the decision function that, when applied to the features, best discriminates between classes. Once the decision function calculation is completed, its coefficients are put into the linear classifier and are not updated unless further offline analyses suggests they should be.

(BTW, FastICA is just an algorithm to do ICA and, despite its name, is not particularly fast. Extended Infomax ICA is the preferred algorithm among EEG researchers. The fastest implementation of that is CUDAICA, which uses parallel GPU cores).

Alberto88
Posts: 23
Joined: 04 May 2014, 09:22

Re: Fastica filter

Post by Alberto88 » 28 May 2014, 13:26

Got it, so I suggest we change the subject to change because they would be too slow to bci2000

At this point do not really know what to do could you tell me if there are other sources of filtering or other classifiers to be able to view and submit as a thesis?

codes can be found on other applications such as Phong or space invaders?

I would like to present those arguments ...


p.s. There is an implementation of CUDAICA you can put in bci2000 without many problems?

Locked

Who is online

Users browsing this forum: No registered users and 1 guest