Skip to content

Fix MSTDPET.reset_state_variables to clear p_plus, p_minus, and moving-average buffer - #777

Open
saachigoyall wants to merge 2 commits into
BindsNET:masterfrom
saachigoyall:master
Open

Fix MSTDPET.reset_state_variables to clear p_plus, p_minus, and moving-average buffer#777
saachigoyall wants to merge 2 commits into
BindsNET:masterfrom
saachigoyall:master

Conversation

@saachigoyall

Copy link
Copy Markdown

Summary

MSTDPET.reset_state_variables (in bindsnet/learning/MCC_learning.py) only zeroed eligibility and eligibility_trace. It left p_plus, p_minus, and the moving-average buffer (average_buffer / average_buffer_index) untouched, so calling network.reset_state_variables() did not fully reset an MSTDPET connection's learning state.

Motivation

In episodic RL training, this caused state to silently persist across episode boundaries even when the network was explicitly reset between episodes, contaminating the start of each new episode with leftover state from the previous one.

Changes

  • MSTDPET.reset_state_variables now also zeros p_plus, p_minus, and (when average_update > 0) average_buffer, and resets
    average_buffer_index to 0.
  • Added test_mstdpet_reset_clears_moving_average_buffer to test/network/test_learning.py, which builds an MSTDPET connection on a MulticompartmentConnection with average_update enabled, runs it long enough to populate all of the above state, calls reset_state_variables(), and asserts everything is zeroed.

@saachigoyall
saachigoyall marked this pull request as ready for review July 30, 2026 01:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant