weights adaption

Forum for discussion on different signal processing algorithms
Locked
tiziano
Posts: 18
Joined: 19 Oct 2008, 10:22

weights adaption

Post by tiziano » 19 Oct 2008, 10:46

Good afternoon,

W're trying reproduce the results described in this article:

Control of two-dimensional movement signals by a noninvasive brain-computer interface in humans, Wolpaw J.R., McFarland J., PNAS, vol. 101, no. 51, december 2004, pages 17849-17854.

We couldn't actually understand if the LMS algorithm for the on-line weight adaption is still impelemented in BCI2000. First we thought that the weights were fixed and this feature was not implemented yet, but today reading other posts in the forum I found that this feature at list existed and was configured within the "Statistics" tab.

Is this feature still implemented? If so, from where can it be configured? Sorry I wasn't able to find any "Statistics" tab.... probably is my fault.

Thanks a lot

Tiziano

gschalk
Posts: 615
Joined: 28 Jan 2003, 12:37

feature adaptation ...

Post by gschalk » 19 Oct 2008, 13:07

Tiziano,

This is a very good observation. BCI2000 v1.x had this feature implemented. However, it required to be configured very carefully, but this procedure was never well documented. The new adaptation procedure in BCI2000 v2.x is very general and nicely documented, but does in fact not include the feature adaptation feature.

Please let us know if you would like to implement this yourself and we will be glad to point you in the right direction.

Gerv

tiziano
Posts: 18
Joined: 19 Oct 2008, 10:22

weights adaption implementation

Post by tiziano » 19 Oct 2008, 13:19

Thanks a lot for your reply,

In this case I think I'll implement this feature myself... so if you have suggestions to give me, they will be very appreciated.

Thanks again,

Tiziano

gschalk
Posts: 615
Joined: 28 Jan 2003, 12:37

adaptation ...

Post by gschalk » 20 Oct 2008, 14:19

Tiziano,

What you will need to do is to write a filter that adapts the features. I.e., you need a filter that is placed between the output of the temporal filter (i.e., spectral estimator using autoregressive parameters realized in ARFilter.cpp) and the linear classifier (realized in LinearClassifier.cpp). To do this, I suggest you copy LinearClassifier.cpp, rename it, e.g., into FeatureAdaptation.cpp, and modify it appropriately so that it takes input features and transforms them according to some rule, e.g., the LMS algorithm. Then, you need to tell the BCI2000 signal processing module to put this new FeatureAdaptation.cpp between ARFilter and LinearClassifier. In the ARSignalProcessing.bpr project, this is accomplished in the PipeDefinition.cpp. This process of programming your own signal processing algorithm and embedding it in the filter chain is also described on:

doc.bci2000.org

search for pipedefinition

I hope this helps.

Gerv

tiziano
Posts: 18
Joined: 19 Oct 2008, 10:22

confirm

Post by tiziano » 24 Oct 2008, 11:06

Gerv,

I have some doubts interpreting the article I mentioned related to the weights adaption algorithm.

In particular this phrase:
Then, the leastmeansquare (LMS) algorithm was used to adjust the
weights to minimize for past trials the difference between:
1) the actual target location and
2) the target location predicted by Eqs. 1 and 2. [that are the two linear equations]
My questions are:
- is term 2) the final location of the cursor at the end of the trial?
- does the algorithm take into account ALL past trials performance at each update step?
- is the performance computed as: (final cursor location - actual target location)^2 (summed up to for all trials) ?

If I understood correctly I should get a 'yes' for all the three questions.

Thanks a lot for your help

Tiziano

gschalk
Posts: 615
Joined: 28 Jan 2003, 12:37

adaptation ...

Post by gschalk » 24 Oct 2008, 11:20

Tiziano,

At first, I have to say that I did not conduct this study myself, so please use my comments with a word of caution.

From my understanding, the difference between actual and predicted target position was calculated, and temporary weights were udpated, at each step. However, the weights were only applied, i.e., the new weights were replaced with the temporary ones, after each trial. In other words, parameters used for cursor movement were not updated during cursor movement.

I am not sure what you mean in the second question with ALL past trials. At each step, e.g., 20-30 times per second, weights were updated with a very small learning coefficient but using only the predictions at that time step, of the basic form as described on

http://www.willamette.edu/~gorr/classes ... delta.html

Gerv

tiziano
Posts: 18
Joined: 19 Oct 2008, 10:22

again on weights adaption

Post by tiziano » 08 Nov 2008, 04:56

Gerv,

Thank you very much for your answer.

I took some time to clearly understand your post, than I took also a look to the code of BCI2000.v1.4 and I got what you did.

Now I have another couple of questions:

- why did you decide to take out this feature in the new version? just because it was difficult to configure and not well documented? or because you realized that this feature was not very useful for the whole task?

- why did you choose to use the "delta rule" when for this problem there is a closed solution for the LMS problem? is there a specific reason for that?

Thank you very much again for your useful help.

Tiziano

gschalk
Posts: 615
Joined: 28 Jan 2003, 12:37

adaptation ...

Post by gschalk » 08 Nov 2008, 09:34

Tiziano,

I did not write the adaptation code. Thus, we could not have been certain that we describe it correctly. Also, correct use of any complex procedure such as this (complex to make it work online, not complex mathematically) is very difficult. We thought that only a very small percentage of users would be able to use this feature appropriately. Finally, feature adaptation is really not necessary for 1D control, which is what the vast majority of users with be using. For these three reasons we did not include this feature in v2.0.

There is no particular reason for using the delta rule. Many robust adaptive learning algorithms will work. It is most likely desirable to have something that can be applied to adapt continually, which is why the delta rule seems more appropriate than applying the LMS algorithm after, say, every session.

Gerwin

tiziano
Posts: 18
Joined: 19 Oct 2008, 10:22

Post by tiziano » 08 Nov 2008, 09:49

Gerv,

Thanks again,
I have only one last doubt, if I can ask.
You said:
feature adaptation is really not necessary for 1D control
Which is the reason for this?

Thanks a lot.

Tiziano

gschalk
Posts: 615
Joined: 28 Jan 2003, 12:37

1D control

Post by gschalk » 08 Nov 2008, 13:00

Tiziano,

The biggest benefit from feature adaptation is that it decorrelates control signals. One could say that it rotates the coordinate system for the control signals so that it it most closely aligned with the desired cartesian output coordinate system, i.e., screen coordinates.

In other words, feature adaptation may always be of benefit, but it will be of more practical benefit for more dimensions. In either case, I strongly recommend to start with 1D control and only then begin with 2D control. Once you mastered 2D control, then you can explore more complex adaptation schemes. The problem is that if you put a complex system together, and make one mistake, it will not work and you will never know why.

Gerv

Locked

Who is online

Users browsing this forum: No registered users and 5 guests