示例#1
0
# weights
w_ih = pnl.MappingProjection(name='input_to_hidden',
                             matrix=np.random.randn(n_input, n_hidden) *
                             wts_init_scale,
                             sender=input,
                             receiver=hidden)

w_ho = pnl.MappingProjection(name='hidden_to_output',
                             matrix=np.random.randn(n_hidden, n_output) *
                             wts_init_scale,
                             sender=hidden,
                             receiver=output)

# ContentAddressableMemory
ContentAddressableMemory = pnl.EpisodicMemoryMechanism(
    cue_size=n_hidden, assoc_size=n_hidden, name='ContentAddressableMemory')

w_hdc = pnl.MappingProjection(
    name='hidden_to_cue',
    matrix=np.random.randn(n_hidden, n_hidden) * wts_init_scale,
    sender=hidden,
    receiver=ContentAddressableMemory.input_states[pnl.CUE_INPUT])

w_hda = pnl.MappingProjection(
    name='hidden_to_assoc',
    matrix=np.random.randn(n_hidden, n_hidden) * wts_init_scale,
    sender=hidden,
    receiver=ContentAddressableMemory.input_states[pnl.ASSOC_INPUT])

w_dh = pnl.MappingProjection(name='em_to_hidden',
                             matrix=np.random.randn(n_hidden, n_hidden) *
示例#2
0
# weights
w_ih = pnl.MappingProjection(name='input_to_hidden',
                             matrix=np.random.randn(n_input, n_hidden) *
                             wts_init_scale,
                             sender=input,
                             receiver=hidden)

w_ho = pnl.MappingProjection(name='hidden_to_output',
                             matrix=np.random.randn(n_hidden, n_output) *
                             wts_init_scale,
                             sender=hidden,
                             receiver=output)

# DictionaryMemory
EM = pnl.EpisodicMemoryMechanism(cue_size=n_hidden,
                                 assoc_size=n_hidden,
                                 name='EM')

w_hdc = pnl.MappingProjection(name='hidden_to_cue',
                              matrix=np.random.randn(n_hidden, n_hidden) *
                              wts_init_scale,
                              sender=hidden,
                              receiver=EM.input_ports[pnl.CUE_INPUT])

w_hda = pnl.MappingProjection(name='hidden_to_assoc',
                              matrix=np.random.randn(n_hidden, n_hidden) *
                              wts_init_scale,
                              sender=hidden,
                              receiver=EM.input_ports[pnl.VALUE_INPUT])

w_dh = pnl.MappingProjection(name='em_to_hidden',
示例#3
0
# weights
w_ih = pnl.MappingProjection(name='input_to_hidden',
                             matrix=np.random.randn(n_input, n_hidden) *
                             wts_init_scale,
                             sender=input,
                             receiver=hidden)

w_ho = pnl.MappingProjection(name='hidden_to_output',
                             matrix=np.random.randn(n_hidden, n_output) *
                             wts_init_scale,
                             sender=hidden,
                             receiver=output)

# DictionaryMemory
EM = pnl.EpisodicMemoryMechanism(key_size, val_size, name='episodic memory')

w_hd = pnl.MappingProjection(name='hidden_to_em',
                             matrix=np.random.randn(n_hidden, n_hidden) *
                             wts_init_scale,
                             sender=hidden,
                             receiver=EM)

w_dh = pnl.MappingProjection(name='em_to_hidden',
                             matrix=np.random.randn(n_hidden, n_hidden) *
                             wts_init_scale,
                             sender=EM,
                             receiver=hidden)

comp = pnl.Composition(name='xor')
# add all nodes
示例#4
0
# weights
w_ih = pnl.MappingProjection(name='input_to_hidden',
                             matrix=np.random.randn(n_input, n_hidden) *
                             wts_init_scale,
                             sender=input,
                             receiver=hidden)

w_ho = pnl.MappingProjection(name='hidden_to_output',
                             matrix=np.random.randn(n_hidden, n_output) *
                             wts_init_scale,
                             sender=hidden,
                             receiver=output)

# ContentAddressableMemory
ContentAddressableMemory = pnl.EpisodicMemoryMechanism(key_size,
                                                       val_size,
                                                       name='episodic memory')

w_hd = pnl.MappingProjection(name='hidden_to_em',
                             matrix=np.random.randn(n_hidden, n_hidden) *
                             wts_init_scale,
                             sender=hidden,
                             receiver=ContentAddressableMemory)

w_dh = pnl.MappingProjection(name='em_to_hidden',
                             matrix=np.random.randn(n_hidden, n_hidden) *
                             wts_init_scale,
                             sender=ContentAddressableMemory,
                             receiver=hidden)

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