Skip to main content

EventFeedbackConfig

The EventFeedbackConfig dataclass defines parameters for event-triggered feedback stimulation. Each in-game event (enemy kills, damage, armor pickup, etc.) can have its own feedback configuration that dynamically scales stimulation parameters based on TD error magnitude.

Core Parameters

List[int]
required
List of channel indices to stimulate when this event occurs. Each event should use a unique set of channels to provide distinct feedback signals.
float
required
Base stimulation frequency in Hertz (Hz). This is the baseline frequency before any TD error scaling is applied.
float
required
Base stimulation amplitude in microamps (μA). This is the baseline amplitude before any TD error scaling is applied.
int
required
Base number of pulses to deliver for this event. This is the baseline pulse count before any TD error scaling is applied.
str
required
Key name used to identify this event in the game info dictionary. Used to trigger the appropriate feedback when events occur.

TD Error Configuration

str
default:"positive"
Which TD error signals trigger this feedback:
  • positive: Only trigger on positive TD errors (better than expected)
  • negative: Only trigger on negative TD errors (worse than expected)
  • absolute: Trigger on any TD error magnitude

Frequency Scaling

float
default:"0.9"
Gain multiplier for TD error to frequency scaling. Higher values make frequency more sensitive to TD error magnitude.
float
default:"2.0"
Maximum scaling factor for frequency. Final frequency = base_frequency * scale, where scale is clamped to [1.0, freq_max_scale].

Amplitude Scaling

float
default:"0.35"
Gain multiplier for TD error to amplitude scaling. Higher values make amplitude more sensitive to TD error magnitude.
float
default:"1.5"
Maximum scaling factor for amplitude. Final amplitude = base_amplitude * scale, where scale is clamped to [1.0, amp_max_scale].

Pulse Count Scaling

float
default:"0.5"
Gain multiplier for TD error to pulse count scaling. Higher values make pulse count more sensitive to TD error magnitude.
float
default:"2.0"
Maximum scaling factor for pulse count. Final pulses = base_pulses * scale, where scale is clamped to [1.0, pulse_max_scale].

Exponential Moving Average

float
default:"0.99"
Beta parameter for exponential moving average of TD errors. Used to track baseline TD error magnitude for normalization. Higher values (closer to 1.0) result in slower adaptation.

Unpredictable Stimulation

Some events (like taking damage) can optionally include unpredictable background stimulation to enhance learning through temporal contrast.
bool
default:"true"
Whether to add unpredictable background stimulation for this event
float
default:"5.0"
Frequency (Hz) for unpredictable background stimulation
float
default:"1.0"
Duration in seconds for each unpredictable stimulation burst
float
default:"1.0"
Rest period in seconds between unpredictable stimulation bursts
Optional[List[int]]
default:"None"
Specific channels to use for unpredictable stimulation. If None, uses the same channels as the main event feedback.
Optional[float]
default:"None"
Amplitude (μA) for unpredictable stimulation. If None, uses the base_amplitude value.

Default Event Configurations

The PPOConfig.event_feedback_settings dictionary contains these default event configurations:

Usage Example

TD Error Scaling Formula

The actual stimulation parameters are computed dynamically based on TD error magnitude:
This allows the feedback intensity to adapt based on how surprising the event is to the current policy.