Purpose: This demo uses the basal ganglia model to cycle through a 5 element sequence, where an arbitrary start can be presented to the model.
Comments: This basal ganglia is now hooked up to a memory and includes routing. The addition of routing allows the system to choose between two different actions: whether to go through the sequence, or be driven by the visual input. If the visual input has its value set to 0.8*START+D (for instance), it will begin cycling through at D->E, etc. The 0.8 scaling helps ensure start is unlikely to accidently match other SPAs (which can be a problem in low dimensional examples like this one).
The ‘utility’ graph shows the utility of each rule going into the basal ganglia. The ‘rule’ graph shows which one has been selected and is driving thalamus.
Usage: When you run the network, it will go through the sequence forever, starting at D. You can right-click the SPA graph and set the value to anything else (e.g. ‘0.8*START+B’) and it will start at the new letter and then begin to sequence through. The point is partly that it can ignore the input after its first been shown and doesn’t perseverate on the letter as it would without gating.
Output: See the screen capture below.
from spa import * D=16 class Rules: #Define the rules by specifying the start state and the #desired next state def start(vision='START'): set(state=vision) def A(state='A'): #e.g. If in state A set(state='B') # then go to state B def B(state='B'): set(state='C') def C(state='C'): set(state='D') def D(state='D'): set(state='E') def E(state='E'): set(state='A') class Routing(SPA): #Define an SPA model (cortex, basal ganglia, thalamus) dimensions=16 state=Buffer() #Create a working memory (recurrent network) #object: i.e. a Buffer vision=Buffer(feedback=0) #Create a cortical network object with no #recurrence (so no memory properties, just #transient states) BG=BasalGanglia(Rules) #Create a basal ganglia with the prespecified #set of rules thal=Thalamus(BG) # Create a thalamus for that basal ganglia (so it # uses the same rules) input=Input(0.1,vision='0.8*START+D') #Define an input; set the input #to state 0.8*START+D for 100 ms model=Routing()