Page 1 of 1

Changes of AdaptCode, what does it mean?

Posted: 23 Nov 2006, 11:09
by pieterlaurens
Hello,

I try to figure out the role of the AdaptCode in the system. I use the ARSignalProcessing and the D2Box. I use the following code to log most parameters and variables in the StatFilter. I added the code to the end of StatFilter::Process(), right before *output = *input.

Code: Select all

        bciout << "adapt code: " << AdaptCode << endl;
   fprintf(Statfile,"%1d\t%1d\t%7.3f\t%7.3f\t%7.3f\t%7.3f\t%7.3f\t%1d\t%1d\t%1d\t%1d\t%7.4f\t%7.4f\t%d\t%d\t%d\t%d\n",
          CurrentTarget,CurrentOutcome,
          ud_gain, lr_gain, yintercept, xintercept,
          WtRate, cur_ystat.pix, cur_xstat.pix,
          cur_ystat.trial_flag, cur_xstat.trial_flag,
          cur_ystat.aper,cur_xstat.aper,
          Xadapt,Yadapt,AdaptCode,OutcomeCode);
   fflush( Statfile );
The AdaptCode is set in D2Box in WriteStateValues(). But this bciout stream only shows a value of 1 (except in the beginning, when adapt code is zero). However in the logfile, AdaptCode changes between 1 and -1.

For the comparisons in the earlier lines (within the if(WtControl > 1){..} statement) also only values for AdaptCode > 0 are considered. I do not get values for AdaptCode other than 1 and -1 in my logfile. Also if I use two control signals.

I do not fully understand the meaning of AdaptCode. I cannot figure it out via this 'reverse engineering'. Could anyone explain the parameter, and why I get these somewhat strange readings in my log-file and warnings.

Thanks in advance,

Pieter Laurens Baljon
University of Groningen

Adaptation Question ...

Posted: 24 Nov 2006, 09:18
by gschalk
Pieter,

The short answer to your question is that you should not worry about AdaptCode.

The long answer is that BCI2000 has quite complex capabilities for real-time system adaptation. The simple levels of adaptation essentially update X/YMean and X/YGain if X/YTrendControl are > 0. They essentially implement a gain controller on the output so that the output is always within a certain value range regardless of what the input features are.

BCI2000 can also adapt the weights given to features in the MUD/MLR matrices. While this provides better performance on 2D cursor control, its use is complicated, not documented, and currently not recommended. This weight adaptation is turned on by setting WeightUse to 1 or 2. In that case, the 5th and 6th row of the TargetPos matrix become targets for a linear prediction for X and Y. For example, for a target on the top and on the bottom you may use +1 and -1 as targets, then set the 7th row (whose value is set to AdaptCode when that target is active) for that target to 2 (1=x adaptation, 2=y adaptation, 3=adapt on both). Then, whenever that target is active, the system tries to modify the weights in the MUD (up/down) matrix so as to optimize performance (using the delta rule (LMS algorithm)). Again, this latter method depends on careful and complex settings and will not work unless done correctly. Again, simply set WeightUse to 0 to avoid all these issues. Over the next few months, we will introduce a simpler and completely documented adaptation scheme that will fix these problems.

In summary, I do not suggest to use the feature adaptation at the moment. I also suggest to use the D2Box_RandomNumber parameter file, and load appropriate parameter file fragments on top of it so that important parameters are set correctly.

I hope this helps,
The Gerv