def model_test_eval(self, tests): """ Take a model and some tests Evaluate a test suite over them. """ from sciunit import TestSuite if type(tests) is TestSuite: not_suite = TSD({t.name: t for t in tests.tests}) OM = OptMan(tests, backend=self._backend) dtc = DataTC() dtc.attrs = self.attrs assert set(self._backend.attrs.keys()) in set(self.attrs.keys()) dtc.backend = self._backend dtc.tests = copy.copy(not_suite) dtc = dtc_to_rheo(dtc) if dtc.rheobase is not None: dtc.tests = dtc.format_test() dtc = list(map(OM.elephant_evaluation, [dtc])) model = dtc.dtc_to_model() model.SM = dtc.SM model.obs_preds = dtc.obs_preds return dtc[0], model
def generate_prediction(self,model = None): if self.prediction is None: dtc = DataTC() dtc.backed = model.backend dtc.attrs = model.attrs dtc.rheobase = model.rheobase dtc.tests = [self] dtc = three_step_protocol(dtc) dtc,ephys0 = allen_wave_predictions(dtc,thirty=True) dtc,ephys1 = allen_wave_predictions(dtc,thirty=False) if self.name in ephys0.keys(): feature = ephys0[self.name] self.prediction = {} self.prediction['value'] = feature #self.prediction['std'] = feature if self.name in ephys1.keys(): feature = ephys1[self.name] self.prediction = {} self.prediction['value'] = feature #self.prediction['std'] = feature return self.prediction
hold_constant_glif = {} for k,v in gd.items(): if k not in explore_ranges: hold_constant_glif[k] = v try: with open('glif_seeds.p','rb') as f: seeds = pickle.load(f) assert seeds is not None except: 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 = {}