def switch_to_initialization_trial(mechanisms):
     # Turn off accumulation
     switch_integrator_mode(mechanisms, False)
     # Turn off noise
     switch_noise(mechanisms, 0)
     # Execute once per trial
     my_Stroop.termination_processing = {pnl.TimeScale.TRIAL: pnl.AllHaveRun()}
Пример #2
0
 def _switch_trial_settings(self,
                            integrator_mode=False,
                            noise=0,
                            termination: pnl.Condition = pnl.AllHaveRun(),
                            learning=False):
     self._switch_integrator_mode(integrator_mode)
     self._switch_noise(noise)
     self.system.termination_processing = {pnl.TimeScale.TRIAL: termination}
     for learning_mechanism, learning_rate in self.learning_mechanisms_to_learning_rates.items(
     ):
         learning_mechanism.learning_rate = learning and learning_rate or 0
Пример #3
0
Inner_Composition.add_node(E)
Inner_Composition.add_node(F)

Inner_Composition.add_projection(
    projection=pnl.MappingProjection(
        name="MappingProjection from E[RESULT] to F[InputPort-0]",
        function=pnl.LinearMatrix(matrix=[[1.0]]),
    ),
    sender=E,
    receiver=F,
)


Inner_Composition.scheduler.termination_conds = {
    pnl.TimeScale.RUN: pnl.Never(),
    pnl.TimeScale.TRIAL: pnl.AllHaveRun(),
}

comp.add_node(A)
comp.add_node(B)
comp.add_node(C)
comp.add_node(D)
comp.add_node(Inner_Composition)

comp.add_projection(
    projection=pnl.MappingProjection(
        name="MappingProjection from A[RESULT] to B[InputPort-0]",
        function=pnl.LinearMatrix(matrix=[[1.0]], default_variable=[2.0]),
    ),
    sender=A,
    receiver=B,
)
Stroop_model.add_projection(
    projection=pnl.MappingProjection(
        name="MappingProjection_from_TASK_RESULT__to_word_hidden_InputPort_0",
        function=pnl.LinearMatrix(default_variable=[0.5, 0.5],
                                  matrix=[[0.0, 0.0], [4.0, 4.0]]),
    ),
    sender=TASK,
    receiver=word_hidden,
)
Stroop_model.add_controller(CONTROL)

Stroop_model.scheduler.add_condition(word_hidden,
                                     pnl.EveryNCalls(dependency=TASK, n=10))
Stroop_model.scheduler.add_condition(color_hidden,
                                     pnl.EveryNCalls(dependency=TASK, n=10))
Stroop_model.scheduler.add_condition(
    OUTPUT,
    pnl.All(
        pnl.EveryNCalls(dependency=color_hidden, n=1),
        pnl.EveryNCalls(dependency=word_hidden, n=1),
    ),
)
Stroop_model.scheduler.add_condition(DECISION,
                                     pnl.EveryNCalls(dependency=OUTPUT, n=1))

Stroop_model.scheduler.termination_conds = {
    pnl.TimeScale.ENVIRONMENT_SEQUENCE: pnl.Never(),
    pnl.TimeScale.ENVIRONMENT_STATE_UPDATE: pnl.AllHaveRun(),
}
Пример #5
0
import psyneulink as pnl

comp = pnl.Composition(name='comp')

fn = pnl.IntegratorMechanism(name='fn', function=pnl.FitzHughNagumoIntegrator(name='FitzHughNagumoIntegrator Function-0', d_v=1, initial_v=-1, initializer=[1.0], default_variable=[[0]]))

comp.add_node(fn)


comp.scheduler.add_condition(fn, pnl.Always())

comp.scheduler.termination_conds = {pnl.TimeScale.RUN: pnl.Never(), pnl.TimeScale.TRIAL: pnl.AllHaveRun()}
comp.show_graph()