def simulate(seed, dt):
    """
    simulate 10 progressive recall of the original
    pattern at different dt according to the STDP 
    rule found experimentally


    """
    ncells = 3000 # number of cells
    c = 0.5       # connection probability 
    a = 0.1       # activity of a pattern
    m = 50        # number of patterns to store
    g1 = 0.433    # slope of inhibitory component
    
    W = topology(ncells, c, seed)
    Z = Pattern(ncells, a)
    Y = generate(Z, m)

    J = clipped_Hebbian(Y, W)
    J = J*delta_t(dt)


    overlap = np.empty(10)
    X = Y[0] # initial pattern

    for i in range(10):
        h = np.inner(J.T, X)/float(ncells)
        spk_avg = np.mean(X)
        X = ( h < g1*spk_avg ).choose(1,0)
        overlap[i] = get_overlap(Z, X)

    return(overlap)
    def __call__(self, seed):
        """
        create a connectivity matrix (W) and update
        the matrix of synaptic weigths (J) according
        to the sequence of patterns (Y)
        """
        self.seed = seed # update seed

        self.W = topology(self.n, self.c, self.seed)
        self.J = clipped_Hebbian(self.Y, self.W) # time consuming step
def create_synaptic_weights(seed):
    """
    create a matrix of synaptic weigths according to
    the clipped_Hebbian rule describied in Gibson & Robinson 1992

    returns the matrix of connectivity, the original pattern and
    the matrix of synaptic weights
    """

    W = topology(ncells, c, seed)
    Z = Pattern(ncells, a)
    Y = generate(Z, m)

    J = clipped_Hebbian(Y,W)
    return(W, Z, Y, J)
def create_synaptic_weights(seed):
    """
    simulate 10 progressive recalls of a partial 
    pattern at different dt according to the STDP 
    rule found experimentally

    Returns:
    The connectivity matrix 
    The original pattern to be recall
    The matrix of synaptic weights
    """
    
    W = topology(ncells, c, seed)
    Z = Pattern(ncells, a)
    Y = generate(Z, m)

    J = clipped_Hebbian(Y, W)
    return(W, Z, Y, J)
Example #5
0
# To execute with seed=100
# ./test_model 100
# =========================================================================

from network import topology
from firings import Pattern
from firings import generate, get_valid, get_spurious, get_overlap
from plasticity import clipped_Hebbian
from plots import raster_plot

import numpy as np
import sys

myseed = int(sys.argv[1])  # read the first argument of the command
ncells = 3000
W = topology(n=ncells, c=0.5, seed=myseed)
Z = Pattern(n=ncells, a=0.1)
Y = generate(Z, m=50)

J = clipped_Hebbian(Y, W)  # 8.93 s


# Recall
X = Y[0]  # The initial state is exactly the same as the initial pattern

nrecall = 6
spikes = np.empty((nrecall, ncells))

X = Y[0]  # The initial state is exactly the same as the initial pattern
for i in range(6):  # progressive recall in 6 steps
#=========================================================================

from network import topology
from firings import Pattern, generate
from plasticity import clipped_Hebbian
from plots import raster_plot
from STDP import delta_t

import numpy as np

n = 3000
c = 0.5
a = 0.1
g = 0.433

W = topology(n, c)
Z = Pattern(n, a)
Y = generate(Z, m = 50)

J = clipped_Hebbian(Y, W) # 8.93 s
J = J*delta_t(50)

# create a random distortion of Z
# 10% of the initial ones
b1 = 0.1
#bn = 1
X = np.zeros(n, dtype=int)

similarity =  int(n*a*b1)
X[:similarity] = 1