Jump to content

User Reference:Normalizer

From BCI2000 Wiki
Revision as of 15:52, 4 April 2007 by Mellinger (talk | contribs)

Function

Normalizing Transform

The Normalizer applies a linear transformation to its input signal. For each channel, an offset value is subtracted, and the result multiplied with a gain value:

outputi=(inputiNormalizerOffseti)×NormalizerGaini

Adaptation

From the past statistics of its input, the Normalizer estimates offset and gain values adaptively to make its output signal

  • zero mean, and
  • unit variance.

The Normalizer uses data buffers to accumulate its past input according to user-defined rules. These rules are called buffer conditions because they are given in terms of boolean expressions. Each data buffer is associated with such a boolean expression. Whenever an expression evaluates to true, the current input will be appended to the associated buffer. Whenever it comes to updating offset and gain values, the Normalizer will use the content of its buffers to estimate data mean and variance. The offset will then be set to the data mean, and the gain to the inverse square root of the data variance, i.e., the inverse of the data standard deviation.

Adaptation Rationale

It may appear crude to use the total data variance for the adaptation -- why not use linear regression on data labels (target codes) to separate into user controlled (task determined) and noise variance? User controlled variance would then correspond to target separation on the feedback screen, which is what we want to normalize in the first place.

However, a closer look reveals that the relative size of user controlled variance, and noise variance is crucial. When that "signal" variance is small compared to noise variance, we would be ill advised to use it in normalization -- this would only lead to enlarged noise, and an erratically moving cursor on the feedback screen. In this case, we rather want to normalize by noise variance, to keep the cursor well-behaved. At the same time, total variance approaches noise variance in this limit because signal variance is small.

On the other end of the spectrum, we have a signal variance that is large compared to noise variance. Here, we clearly want normalization by signal variance. However, the total variance will be dominated by signal variance. Thus, in the limit of high signal-to-noise ratio, total variance again is the entity we want to normalize by.

Thus, no matter whether signal-to-noise ratio is high or low, total data variance is a good choice for normalization.

Typical Use

Typically, the Normalizer's input is the output of a classifier, which it transforms into a zero mean/unit variance control signal which is then transmitted to an application module. Using the zero mean/unit variance property, an application module can then relate entities such as window size, screen update rate, cursor speed, and trial duration.

Parameters

For each channel of the Normalizer's input signal, adaptation is treated independently. Offsets, Gains, and Adaptation kind are represented as list parameters, with each entry in the list corresponding to a signal channel. Buffer configuration is done in matrix form, with columns corresponding to signal channels, and rows corresponding to multiple buffers.

NormalizerOffsets, NormalizerGains

Lists of offset and gain values, with entries corresponding to signal channels. These values will be updated depending on the channel's adaptation configuration in the Adaptation parameter.

Adaptation

A list of values that determines individual channels' adaptation strategy. Possible values are

  • 0 for no adaptation,
  • 1 for adjusting offsets to zero mean,
  • 2 for additionally adjusting gains to unit variance.

BufferConditions

A matrix consisting of boolean expressions. Expressions may involve States and the components of the Normalizer's input signal.

  • Each matrix entry represents a data buffer which is a ring buffer of length BufferLength. Whenever a buffer's expression evaluates to true, the current value of the input signal will be put into the buffer (overwriting past data once the buffer is filled).
  • Buffers in a certain column will buffer data from the corresponding signal channel, and will be used in adaptation of that channel only.
  • Within columns, the order of buffers does not affect computation.
  • Empty expressions do not have any effect on the computation. Thus, it is possible to have a different number of buffers for different channels.
  • A buffer to store data for the first target, and during feedback only, should have an expression such as (Feedback)&&(TargetCode==1).

BufferLength

The maximum length of each data buffer.

  • The length is specified in data blocks if given as a raw number, and in seconds if given as a number followed by the character "s".
  • All data buffers have the same capacity.
  • Once a data buffer is filled, its older entries will be replaced with new data (ring buffer).

UpdateTrigger

A boolean expression that triggers adaptation when changing to true from false. Generally, continuous adaptation within trials is not desired. Rather, one wants adaptation to occur at the end of a trial. This is achieved with UpdateTrigger expressions such as Feedback!=0 or TargetCode!=0.

States

Buffer condition expressions, and the UpdateTrigger expression may involve any State present in the system. Expressions are checked for syntactical correctness and whether states are present during the Preflight Phase.

Examples

Trial-based 1D Feedback Task with pre-defined Targets

Trial-based 2D Feedback Task with pre-defined Targets

Continuous 1D Control without pre-defined Targets


See also: User Reference:Expression Syntax