Пример #1
0
def fit((repetition_i,p)):

    neuron = get_default("neuron")
    neuron["phi"]['alpha'] = p["alpha"]
    neuron["phi"]['beta'] = p["beta"]
    neuron["phi"]['r_max'] = p["r_max"]

    learn = get_default("learn")
    learn["eta"] = 4e-7

    my_s = {
        'start': 0.0,
        'end': 1000.0,
        'dt': 0.05,
        'pre_spikes': [np.arange(50.0,1000.0,250.0)],
        'I_ext': lambda t:0.0
        }

    seed = int(int(time.time()*1e8)%1e9)
    accs = [PeriodicAccumulator(['weights'], interval=10)]
    if p["h1"]:
        accums = run(my_s, lambda **kwargs:False, get_dendr_spike_det(p["thresh"]), accs, seed=seed, neuron=neuron, learn=learn, voltage_clamp=True, U_clamp=p['Uclamp'], h=1.0)
    else:
        accums = run(my_s, lambda **kwargs:False, get_dendr_spike_det(p["thresh"]), accs, seed=seed, neuron=neuron, learn=learn, voltage_clamp=True, U_clamp=p['Uclamp'])

    dump(accums,'artola/'+p['ident'])
Пример #2
0
def vary((repetition_i,p)):

    n_vary = 5

    values = {True: {"alpha":-55.0,
                     "beta":0.4,
                     "r_max":0.3},
              False: {"alpha":-59.0,
                      "beta":0.5,
                      "r_max":0.17}}

    vary = {"alpha":(-2.0,2.0),
              "beta":(-0.1,0.2),
              "r_max":(-0.05,0.15)}

    down = vary[p["vary"]][0]
    up = vary[p["vary"]][1]
    middle = values[p["h1"]][p["vary"]]
    vary_val = np.linspace(middle+down, middle+up, n_vary)[p["i"]]
    values[p["h1"]][p["vary"]] = vary_val
    values = values[p["h1"]]

    neuron = get_default("neuron")
    neuron["phi"]['r_max'] = values["r_max"]
    neuron["phi"]['alpha'] = values["alpha"]
    neuron["phi"]['beta'] = values["beta"]

    learn = get_default("learn")
    learn["eps"] = learn["eps"]*p["l_f"]
    learn["eta"] = learn["eta"]*p["l_f"]
    if not p["h1"]:
        learn["eta"] = learn["eta"]*2.5
    else:
        learn["eta"] = learn["eta"]*1.3


    spikes = np.array([61.0])

    my_s = {
        'start': 0.0,
        'end': 150.0,
        'dt': 0.05,
        'pre_spikes': [spikes + p["delta"]],
        'I_ext': lambda t: 0.0
        }


    seed = 1
    accs = [PeriodicAccumulator(['y','weights'], interval=10), BooleanAccumulator(['spike', 'dendr_spike', 'pre_spikes'])]
    if p["h1"]:
        accums = run(my_s, get_fixed_spiker(spikes), get_dendr_spike_det(-50.0), accs, seed=seed, neuron=neuron, learn=learn, h=1.0)
    else:
        accums = run(my_s, get_fixed_spiker(spikes), get_dendr_spike_det(-50.0), accs, seed=seed, neuron=neuron, learn=learn)

    dump((accums, values),'bi_poo/'+p['ident'])
Пример #3
0
def fit((repetition_i, p)):

    learn = get_default("learn")
    if p["h1"]:
        learn['eta'] *= 0.125 / 8.0
    else:
        learn["eta"] *= 0.1

    neuron = get_default("neuron")
    neuron["phi"]['r_max'] = 0.2
    neuron["phi"]['alpha'] = -54.0
    neuron["phi"]['beta'] = 0.25

    p_backprop = 0.75

    freq = p["freq"]
    delta = p["delta"]

    n_spikes_in_burst = 10
    burst_pause = 200.0
    bursts = 50 / n_spikes_in_burst
    burst_dur = 1000.0 * n_spikes_in_burst / freq

    first_spike = 1000.0 / (2 * freq)
    isi = 1000.0 / freq
    t_end = bursts * (burst_dur + burst_pause)

    spikes_in_burst = np.arange(first_spike, burst_dur, isi)
    spikes = np.array([])
    for i in range(bursts):
        spikes = np.concatenate((spikes, spikes_in_burst + i * (burst_dur + burst_pause)))

    pre_spikes = spikes + delta

    my_s = {
        'start': 0.0,
        'end': t_end,
        'dt': 0.05,
        'pre_spikes': [pre_spikes],
        'I_ext': lambda t: 0.0
    }

    seed = int(int(time.time() * 1e8) % 1e9)
    accs = [PeriodicAccumulator(['weights'], interval=100)]
    if p["h1"]:
        accums = run(my_s, get_fixed_spiker(spikes), get_dendr_spike_det(-50.0), accs,
                     seed=seed, learn=learn, neuron=neuron, h=1.0, p_backprop=p_backprop)
    else:
        accums = run(my_s, get_fixed_spiker(spikes), get_dendr_spike_det(-50.0), accs,
                     seed=seed, learn=learn, neuron=neuron, p_backprop=p_backprop)

    dump(accums, 'sjostrom/' + p['ident'])
Пример #4
0
def task((repetition_i,p)):

    eps_stim = eps_stim_low+(eps_stim_high-eps_stim_low)*np.random.rand()

    learn = get_default("learn")
    learn["eta"] = [1e-7, 0.0]
    learn["eps"] = [p["eps_learn"],10**eps_stim]

    neuron = get_default("neuron")
    neuron["phi"]["alpha"] = -52.0
    neuron["phi"]["beta"] = 0.25
    neuron["phi"]["r_max"] = 0.35


    post_spikes = np.arange(40.0,2000.0,20.0)
    pre_spikes_learn = post_spikes - 10.0
    pre_spikes_stim = post_spikes - p["stim_delta"]

    my_s = {
        'start': 0.0,
        'end': 2000.0,
        'dt': 0.05,
        'pre_spikes': [pre_spikes_learn, pre_spikes_stim],
        'I_ext': lambda t: 0.0
        }

    prob = p["prob"]


    seed = int(int(time.time()*1e8)%1e9)
    accs = [PeriodicAccumulator(['weights'], interval=100)]
    accums = run(my_s, get_fixed_spiker(post_spikes), get_dendr_spike_det(p["thresh"]), accs, neuron=neuron, seed=seed, learn=learn, p_backprop=prob)


    dump((eps_stim,accums),p['ident'])
Пример #5
0
def fit((repetition_i, p)):

    neuron = get_default("neuron")
    neuron["phi"]['alpha'] = p["alpha"]
    neuron["phi"]['beta'] = p["beta"]
    neuron["phi"]['r_max'] = p["r_max"]

    learn = get_default("learn")
    learn["eta"] = 4e-7

    my_s = {
        'start': 0.0,
        'end': 1000.0,
        'dt': 0.05,
        'pre_spikes': [np.arange(50.0, 1000.0, 250.0)],
        'I_ext': lambda t: 0.0
    }

    seed = int(int(time.time() * 1e8) % 1e9)
    accs = [PeriodicAccumulator(['weights'], interval=10)]
    if p["h1"]:
        accums = run(my_s,
                     lambda **kwargs: False,
                     get_dendr_spike_det(p["thresh"]),
                     accs,
                     seed=seed,
                     neuron=neuron,
                     learn=learn,
                     voltage_clamp=True,
                     U_clamp=p['Uclamp'],
                     h=1.0)
    else:
        accums = run(my_s,
                     lambda **kwargs: False,
                     get_dendr_spike_det(p["thresh"]),
                     accs,
                     seed=seed,
                     neuron=neuron,
                     learn=learn,
                     voltage_clamp=True,
                     U_clamp=p['Uclamp'])

    dump(accums, 'artola/' + p['ident'])
def vary((repetition_i,p)):
    
    etas = {True: 6e-8,
            False: 30e-8}
            
    varies = {"alpha": np.linspace(-52.0,-56.0,3),
              "beta": np.linspace(0.15,0.25,3),
              "r_max": np.linspace(0.1,0.3,3)}

    learn = get_default("learn")
    learn["eta"] = etas[p["h1"]]

    neuron = get_default("neuron")
    neuron["phi"]["alpha"] = -54.0
    neuron["phi"]["beta"] = 0.25
    neuron["phi"]["r_max"] = 0.2
    neuron["phi"][p["vary"]] = varies[p["vary"]][p["ivary"]]


    spikes = np.arange(20.0,301.0,20.0)

    my_s = {
        'start': 0.0,
        'end': 350.0,
        'dt': 0.05,
        'pre_spikes': [spikes-10.0],
        'I_ext': lambda t: 0.0
        }

    # 0.2 <= p <= 1.0
    prob = 0.2 + 0.8*np.random.rand()

    seed = int(int(time.time()*1e8)%1e9)
    accs = [PeriodicAccumulator(['weights'], interval=10)]
    if p["h1"]:
        accums = run(my_s, get_fixed_spiker(spikes), get_dendr_spike_det(-50.0), accs, neuron=neuron, seed=seed, learn=learn, p_backprop=prob, h=1.0)
    else:
        accums = run(my_s, get_fixed_spiker(spikes), get_dendr_spike_det(-50.0), accs, neuron=neuron, seed=seed, learn=learn, p_backprop=prob)


    dump((prob,accums),'sjostrom_switch/'+p['ident'])
Пример #7
0
def fit((repetition_i,p)):

    values = {True: {"alpha":-55.0,
                     "beta":0.4,
                     "r_max":0.3},
              False: {"alpha":-59.0,
                      "beta":0.5,
                      "r_max":0.17}}

    neuron = get_default("neuron")
    neuron["phi"]['r_max'] = values[p["h1"]]["r_max"]
    neuron["phi"]['alpha'] = values[p["h1"]]["alpha"]
    neuron["phi"]['beta'] = values[p["h1"]]["beta"]

    learn = get_default("learn")
    if not p["h1"]:
        learn["eta"] = learn["eta"]*2.5
    else:
        learn["eta"] = learn["eta"]*1.3


    spikes = np.array([101.0])

    my_s = {
        'start': 0.0,
        'end': 300.0,
        'dt': 0.05,
        'pre_spikes': [spikes + p["delta"]],
        'I_ext': lambda t: 0.0
        }


    seed = 1
    accs = [PeriodicAccumulator(['y','weights'], interval=10), BooleanAccumulator(['spike', 'dendr_spike', 'pre_spikes'])]
    if p["h1"]:
        accums = run(my_s, get_fixed_spiker(spikes), get_dendr_spike_det(-50.0), accs, seed=seed, neuron=neuron, learn=learn, h=1.0)
    else:
        accums = run(my_s, get_fixed_spiker(spikes), get_dendr_spike_det(-50.0), accs, seed=seed, neuron=neuron, learn=learn)

    dump((accums, values),'bi_poo/'+p['ident'])
def task((repetition_i, p)):

    eps_stim = eps_stim_low + (eps_stim_high - eps_stim_low) * np.random.rand()

    learn = get_default("learn")
    learn["eta"] = [1e-7, 0.0]
    learn["eps"] = [p["eps_learn"], 10**eps_stim]

    neuron = get_default("neuron")
    neuron["phi"]["alpha"] = -52.0
    neuron["phi"]["beta"] = 0.25
    neuron["phi"]["r_max"] = 0.35

    post_spikes = np.arange(40.0, 2000.0, 20.0)
    pre_spikes_learn = post_spikes - 10.0
    pre_spikes_stim = post_spikes - p["stim_delta"]

    my_s = {
        'start': 0.0,
        'end': 2000.0,
        'dt': 0.05,
        'pre_spikes': [pre_spikes_learn, pre_spikes_stim],
        'I_ext': lambda t: 0.0
    }

    prob = p["prob"]

    seed = int(int(time.time() * 1e8) % 1e9)
    accs = [PeriodicAccumulator(['weights'], interval=100)]
    accums = run(my_s,
                 get_fixed_spiker(post_spikes),
                 get_dendr_spike_det(p["thresh"]),
                 accs,
                 neuron=neuron,
                 seed=seed,
                 learn=learn,
                 p_backprop=prob)

    dump((eps_stim, accums), p['ident'])
Пример #9
0
def fit((repetition_i, p)):

    learn = get_default("learn")
    if p["h1"]:
        learn['eta'] *= 0.125 / 8.0
    else:
        learn["eta"] *= 0.1

    neuron = get_default("neuron")
    neuron["phi"]['r_max'] = 0.2
    neuron["phi"]['alpha'] = -54.0
    neuron["phi"]['beta'] = 0.25

    p_backprop = 0.75

    freq = p["freq"]
    delta = p["delta"]

    n_spikes_in_burst = 10
    burst_pause = 200.0
    bursts = 50 / n_spikes_in_burst
    burst_dur = 1000.0 * n_spikes_in_burst / freq

    first_spike = 1000.0 / (2 * freq)
    isi = 1000.0 / freq
    t_end = bursts * (burst_dur + burst_pause)

    spikes_in_burst = np.arange(first_spike, burst_dur, isi)
    spikes = np.array([])
    for i in range(bursts):
        spikes = np.concatenate(
            (spikes, spikes_in_burst + i * (burst_dur + burst_pause)))

    pre_spikes = spikes + delta

    my_s = {
        'start': 0.0,
        'end': t_end,
        'dt': 0.05,
        'pre_spikes': [pre_spikes],
        'I_ext': lambda t: 0.0
    }

    seed = int(int(time.time() * 1e8) % 1e9)
    accs = [PeriodicAccumulator(['weights'], interval=100)]
    if p["h1"]:
        accums = run(my_s,
                     get_fixed_spiker(spikes),
                     get_dendr_spike_det(-50.0),
                     accs,
                     seed=seed,
                     learn=learn,
                     neuron=neuron,
                     h=1.0,
                     p_backprop=p_backprop)
    else:
        accums = run(my_s,
                     get_fixed_spiker(spikes),
                     get_dendr_spike_det(-50.0),
                     accs,
                     seed=seed,
                     learn=learn,
                     neuron=neuron,
                     p_backprop=p_backprop)

    dump(accums, 'sjostrom/' + p['ident'])