Fix MSTDPET.reset_state_variables to clear p_plus, p_minus, and moving-average buffer - #777
Fix MSTDPET.reset_state_variables to clear p_plus, p_minus, and moving-average buffer#777saachigoyall wants to merge 2 commits into
Conversation
|
Hi Saachi, Thanks, the diagnosis is right. MSTDPET was clearing 2 of its 6 variables and your one line fix is correct. Three things came out of checking it:
I wanted to push the wider fix onto your branch so this PR stays yours, but my token does not have the workflow scope and bringing master in touches Closing this one in favour of #794. The bug is yours, thanks for finding it. Please do send more. |
Summary
MSTDPET.reset_state_variables(inbindsnet/learning/MCC_learning.py) only zeroedeligibilityandeligibility_trace. It leftp_plus,p_minus, and the moving-average buffer (average_buffer/average_buffer_index) untouched, so callingnetwork.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_variablesnow also zerosp_plus,p_minus, and (whenaverage_update > 0)average_buffer, and resetsaverage_buffer_indexto 0.test_mstdpet_reset_clears_moving_average_buffertotest/network/test_learning.py, which builds an MSTDPET connection on aMulticompartmentConnectionwithaverage_updateenabled, runs it long enough to populate all of the above state, callsreset_state_variables(), and asserts everything is zeroed.