def initialize_network(self, params): allBut1 = schemes.get("allBut1") all2all = schemes.get("all2all") Input = population.Image_Input(28, 28) c_params = { "eta": params.get("eta", 0.0005), "mu": params.get("mu", 0.05), } L1 = population.Population(num_neurons=params.get("num_neurons", 16), v_init=params.get("v_init", -65), v_decay=params.get("v_decay", .99), v_reset=params.get("v_reset", -65), min_volt=params.get("v_rest", -65), t_init=params.get("min_volt", -50), min_thresh=params.get("min_thresh", -52), t_bias=params.get("t_bias", 0.25), t_decay=params.get("t_decay", .9999999), trace_decay=params.get("trace_decay", 0.95), refrac=params.get("refrac", 5), one_spike=params.get("one_spike", True)) inh = params.get("inh", -120) C1 = Connection(Input, L1, 0.3 * all2all(Input.num_neurons, L1.num_neurons), params, rule="PreAndPost", wmin=0, wmax=1) C2 = Connection(L1, L1, allBut1(L1.num_neurons) * inh, params, rule="static", wmin=inh, wmax=0) self.network = Network([ Input, L1, ], [ C1, C2, ])
rand = schemes.get("random") allBut1 = schemes.get("allBut1") grid = schemes.get("grid") all2all = schemes.get("all2all") one2one = schemes.get("one2one") local = schemes.get("local") (x_train, y_train), (x_test, y_test) = mnist.load_data() for x in x_train: x = x.astype(float) * 2 ''' Initialize populations ''' Input = population.Image_Input() L1 = population.Population(num_neurons=100, v_init=-65, v_decay=.99, v_reset=-60, min_volt=-65, t_init=-52, min_thresh=-52, t_bias=0.05, t_decay=.9999999, refrac=5, trace_decay=.95, one_spike=True) L2 = population.Population( num_neurons=100, v_init=-65,
different connection schemes ''' rand = schemes.get("random") allBut1 = schemes.get("allBut1") grid = schemes.get("grid") all2all = schemes.get("all2all") one2one = schemes.get("one2one") local = schemes.get("local") (x_train, y_train), (x_test, y_test) = mnist.load_data() ''' Initialize default populations ''' Input = population.Image_Input(28,28) L1 = population.Population(num_neurons = 100) L2 = population.Population(num_neurons = 100) ''' Initialize connections ''' inh = -120 C1 = Connection(Input, L1, 0.3 * all2all(Input.num_neurons, L1.num_neurons), params, rule = "PreAndPost", wmin = 0, wmax = 1)