def start(self): super(Experiment_alignment, self).start() c = self.params.c self.source = NoSource() stats_all = [ ActivityStat(), ConnectionFractionStat(), WeightHistoryStat('W_ee', record_every_nth=c.N_steps / 1000), ParamTrackerStat(), WeeFailureStat(), WeeFailureFuncStat() ] stats_single = [ #CounterStat(), PopulationVariance(), ISIsStat(), EndWeightStat(), WeightChangeStat(), # WeightLifetimeStat(), #SpikesStat(), #FullEndWeightStat(), HistoryStat('W_ee.stdp_dw', record_every_nth=c.N_steps / 1000) ] if c.double_synapses: stats_all += [ WeightHistoryStat('W_ee_2', record_every_nth=c.N_steps / 1000) ] return (self.source, stats_all + stats_single, stats_all)
def run(self, sorn): super(Experiment_spont, self).run(sorn) c = self.params.c sorn.simulation(c.steps_plastic) sorn.update = False # Run with trials trialsource = TrialSource(self.inputsource.source, c.wait_min_train, c.wait_var_train, zeros(self.inputsource.source.N_a), 'reset') sorn.source = trialsource shuffle(sorn.x) shuffle(sorn.y) sorn.simulation(c.steps_noplastic_train) # Run with spont spontsource = NoSource(sorn.source.source.N_a) sorn.source = spontsource shuffle(sorn.x) shuffle(sorn.y) # Simulate spontaneous activity sorn.c.ff_inhibition_broad = 0 if not c.always_ip: sorn.c.eta_ip = 0 sorn.simulation(c.steps_noplastic_test) return { 'source_plastic': self.inputsource, 'source_train': trialsource, 'source_test': spontsource }
def run(self, sorn): super(Experiment_mcmc_withSTDP, self).run(sorn) c = self.params.c # If filename was not set, we are in single mode if not c.has_key('file_name'): c.file_name = "single" # If state does not exist, create it if not c.has_key('state'): c.state = utils.Bunch() if c.display == True: print('Run self organization:') sorn.simulation(c.steps_plastic) ## Prepare noplastic training sorn.update = False # Run with trials # self.inputsource.source.N_a: Size of input source (letters, sequences), e.g. 4 trialsource = TrialSource(self.inputsource.source, c.wait_min_train, c.wait_var_train, zeros(self.inputsource.source.N_a), 'reset') sorn.source = trialsource shuffle(sorn.x) # {0,1} shuffle(sorn.y) # {0,1} if c.display == True: print('\nRun training:') sorn.simulation(c.steps_noplastic_train) ## Prepare plastic testing # Activate stdp again sorn.update = True # Run with spont (input u is always zero) spontsource = NoSource(sorn.source.source.N_a) sorn.source = spontsource shuffle(sorn.x) shuffle(sorn.y) # Simulate spontaneous activity sorn.c.ff_inhibition_broad = 0 if not c.always_ip: sorn.c.eta_ip = 0 if c.display == True: print('\nRun testing:') sorn.simulation(c.steps_noplastic_test) return { 'source_plastic': self.inputsource, 'source_train': trialsource, 'source_test': spontsource }
def run(self, sorn): super(Experiment_sequence, self).run(sorn) c = self.params.c # Simulate with plasticity sorn.simulation(c.steps_plastic) # Turn off plasticity sorn.update = False # Shuffle (Gordon's idea) shuffle(sorn.x) shuffle(sorn.y) # Run with test words source = sorn.source.source source.words = self.test_words N_words = len(source.words) source.probs = array([ones(N_words)] * N_words) source.probs /= sum(source.probs, 1) source.glob_ind = [0] source.glob_ind.extend(cumsum(map(len, source.words))) source.word_index = 0 source.ind = 0 spontsource = NoSource(sorn.source.source.N_a) sorn.source = spontsource if not c.always_ip: sorn.c.eta_ip = 0 sorn.simulation(c.steps_noplastic_train) # Run again trialsource = TrialSource(source, c.wait_min_train, c.wait_var_train, zeros(source.N_a), 'reset') sorn.source = trialsource sorn.simulation(c.steps_noplastic_test) return { 'source_plastic': self.source_archived, 'source_train': sorn.source, 'source_test': sorn.source }
def start(self): super(Experiment_noinput,self).start() c = self.params.c self.source = NoSource() stats_all = [ ActivityStat(), ConnectionFractionStat(), WeightHistoryStat('W_ee',record_every_nth= c.N_steps/1000), ParamTrackerStat() ] stats_single = [ PopulationVariance(), ISIsStat(), EndWeightStat(), WeightChangeStat(), WeightLifetimeStat(), ] return (self.source,stats_all+stats_single,stats_all)
def start(self): super(Experiment_fiser,self).start() c = self.params.c if self.cluster_param == 'source.prob': prob = c.source.prob assert(prob>=0 and prob<=1) self.params.source = CountingSource( self.params.source.words, np.array([[prob,1.0-prob], [prob,1.0-prob]]), c.N_u_e,c.source.avoid) if c.source.use_randsource: self.params.source = CountingSource.init_simple( c.source.N_words, c.source.N_letters,c.source.word_length, c.source.max_fold_prob,c.N_u_e,c.N_u_i, c.source.avoid) controlsource = copy.deepcopy(self.params.source) controlsource.words = [x[::-1] for x in self.params.source.words] # Control with single letters #~ controlsource.words = controlsource.alphabet #~ N_words = len(controlsource.words) #~ probs = array([ones(N_words)]*N_words) #~ controlsource.probs = probs/sum(probs,1) #~ controlsource.glob_ind = [0] #~ controlsource.glob_ind.extend(cumsum(map(len, #~ controlsource.words))) # Control with different words # Check if ABCD source if controlsource.words == ['DCBA','HGFE']: controlsource.words = ['EDCBA','HGF'] self.plasticsource = TrialSource(self.params.source, c.wait_min_plastic, c.wait_var_plastic, zeros(self.params.source.N_a), 'reset') self.controlsource = TrialSource(controlsource, c.wait_min_train, c.wait_var_train, zeros(controlsource.N_a), 'reset') self.spontsource = NoSource(controlsource.N_a) #Stats inputtrainsteps = c.steps_plastic + c.steps_noplastic_train # For PatternProbabilityStat if c.steps_noplastic_test > 10000: burnin = 5000 else: burnin = c.steps_noplastic_test//2 shuffled_indices = arange(c.N_e) np.random.shuffle(shuffled_indices) N_subset = 16 start_train = c.steps_plastic+burnin half_train = start_train+(inputtrainsteps-start_train)//2 start_test = inputtrainsteps+burnin half_test = start_test+(c.N_steps-start_test)//2 # The output dimensions of these stats have to be independent # of the number of steps! stats_all = [ ParamTrackerStat(), PatternProbabilityStat( [[start_train,half_train], [half_train+burnin,inputtrainsteps], [start_test,half_test], [half_test,c.N_steps]], shuffled_indices[:N_subset], zero_correction=True) ] stats_single = [ InputIndexStat(), SpikesStat(), InputUnitsStat(), ActivityStat(), SpikesStat(inhibitory=True), ISIsStat(interval=[c.steps_plastic, inputtrainsteps]), ConnectionFractionStat(), InputUnitsStat(), ] return (self.plasticsource,stats_single+stats_all,stats_all)
c.T_i_max = 0.5 c.T_i_min = 0.0 c.synaptic_scaling = True c.inhibitory_scaling = False c.noise_sig = np.sqrt(0.05) c.fast_inhibit = False c.k_winner_take_all = False c.ordered_thresholds = False c.experiment.module = 'chartmann.alignment.experiment_alignment' c.experiment.name = 'Experiment_alignment' ####################################### c.stats.file_suffix = 'weightdepfail' ####################################### c.stats.rand_networks = 0 from common.sources import NoSource source = NoSource() # Cluster c.cluster.vary_param = 'W_ee.bias' c.cluster.params = [0.75, 1.0, 1.25] if c.imported_mpi: c.cluster.NUMBER_OF_SIMS = len(c.cluster.params) c.cluster.NUMBER_OF_CORES = MPI.COMM_WORLD.size c.cluster.NUMBER_LOCAL = c.cluster.NUMBER_OF_SIMS\ // c.cluster.NUMBER_OF_CORES
def start(self): super().start() c = self.params.c self.inputsource = NoSource() return self.inputsource