def test_get_ss(self): from neuronunit.optimization.data_transport_container import DataTC dtc = DataTC() self.assertIsNone(dtc.get_ss()) dtc.scores = {'score1': 1} self.assertEqual(dtc.get_ss(), 1) dtc.scores = {'score1': 1, 'score2': 2} self.assertEqual(dtc.get_ss(), 3)
for local_attrs in grid: store_glif_results[str(local_attrs.values())] = {} dtc = DataTC() dtc.tests = use_test complete_params = {} dtc.attrs = local_attrs dtc.backend = 'GLIF' dtc.cell_name = 'GLIF' for key, use_test in test_frame.items(): dtc.tests = use_test dtc = dtc_to_rheo(dtc) dtc = format_test(dtc) if dtc.rheobase is not None: if dtc.rheobase!=-1.0: dtc = nunit_evaluation(dtc) print(dtc.get_ss()) store_glif_results[str(local_attrs.values())][key] = dtc.get_ss() df = pd.DataFrame(store_glif_results) best_params = {} for index, row in df.iterrows(): best_params[index] = row == row.min() best_params[index] = best_params[index].to_dict() seeds = {} for k,v in best_params.items(): for nested_key,nested_val in v.items(): if True == nested_val: seed = nested_key seeds[k] = seed with open('glif_seeds.p','wb') as f:
dtc.attrs = v dtc.backend = 'RAW' dtc.cell_name = 'vanilla' for key, use_test in test_frame.items(): dtc.tests = use_test dtc = dtc_to_rheo(dtc) dtc = format_test(dtc) if dtc.rheobase is not None: if dtc.rheobase!=-1.0: dtc = nunit_evaluation(dtc) df[k][key] = int(dtc.get_ss()) # A sparse grid sampling over the parameter space, using the published and well corrobarated parameter points, from Izhikitch publications, and the Open Source brain, shows that without optimization, using off the shelf parameter sets to fit real-life biological cell data, does not work so well. MU = 6 NGEN = 150 for key, use_test in test_frame.items(): ga_out, _ = om.run_ga(explore_param,NGEN,use_test,free_params=free_params, NSGA = True, MU = MU) test_opt = {str('multi_objective')+str(ga_out):ga_out} with open('multi_objective.p','wb') as f: pickle.dump(test_opt,f) ''' MU = 6