Usage¶
The forward pass is defined in two steps:
(1)¶
where are input stimuli from an incoming layer and are latent activations from a previous step; is the number of active output neurons (winners).
Assembly areas¶
|
A Hebbian-learning recurrent neural network with one or more incoming input layers and only one output layer. |
|
Non-Holographic Associative Memory Area [R9c642b34848c-1]: a recurrent neural network with one or more incoming input layers and only one output layer. |
|
Vertically stacked areas. |
A sequence of areas. |
Activation function¶
|
K-winners-take-all activation function. |
Train and simulate¶
|
Train and simulate Computation with Assemblies. |
Monitoring¶
|
Monitor the training progress. |
|
Computes the expected overlap of binomial sampled random vectors. |
|
Computes the pairwise similarity overlap of the tensors. |
Example¶
Associate script:
from assembly.areas import *
from assembly.samplers import sample_k_active
from assembly.simulate import Simulator
N_NEURONS, K_ACTIVE = 1000, 50
n_stim_a, n_stim_b = N_NEURONS, N_NEURONS // 2
na, nb, nc = N_NEURONS * 2, int(N_NEURONS * 1.5), N_NEURONS
area_A = AreaRNNHebb(N_NEURONS, out_features=na)
area_B = AreaRNNHebb(N_NEURONS // 2, out_features=nb)
area_C = AreaRNNHebb(na, nb, out_features=nc)
area_AB = AreaStack(area_A, area_B)
brain = AreaSequential(area_AB, area_C)
stim_a = sample_k_active(n=n_stim_a, k=K_ACTIVE)
stim_b = sample_k_active(n=n_stim_b, k=K_ACTIVE)
stim_ab = (stim_a, stim_b)
simulator = Simulator(model=brain, epoch_size=10)
simulator.simulate(x_samples=[stim_ab])
More examples are in assembly/simulate.py