def test_detectors_missing(self): with self.assertRaises(builders.InsufficientConfiguration): builders.evaluator_from_dict({ "input_dir": "data", "output_dir": "generated", "records": [] })
def setUp(self): path = '/'.join([THIS_DIR, 'configurations', 'do_everything.json']) with open(path) as f: self.conf = json.load(f) self.conf["input_dir"] = absify(self.conf["input_dir"], dirname(f.name)) self.conf["output_dir"] = absify(self.conf["output_dir"], dirname(f.name)) self.evaluator = evaluator_from_dict(self.conf)
def test_basic_configuration(self): evaluator = builders.evaluator_from_dict({ "input_dir": "data", "output_dir": "generated", "detectors": [{ "type": "WfdbXQRSDetector" }], "records": [] }) self.assertEqual(evaluator.input_dir, "data") self.assertEqual(evaluator.output_dir, "generated") self.assertEqual(evaluator.detectors[0].__class__, WfdbXQRSDetector) self.assertEqual(len(evaluator.records), 0)
def test_name_builder_injection(self): name_builder = builders.NameBuilder() conf_dict = { "input_dir": "data", "output_dir": "generated", "detectors": [{ "type": "WfdbXQRSDetector" }], "records": [] } evaluator = builders.evaluator_from_dict(conf_dict, name_builder) self.assertEqual(name_builder.already_in_use[0], evaluator.detectors[0].name) self.assertEqual(len(name_builder.already_in_use), 1)
def test_output_dir_missing(self): with self.assertRaises(builders.InsufficientConfiguration): builders.evaluator_from_dict({"input_dir": "data"})
help="Configuration file specifying the evaluation.") args = parser.parse_args() sys.path.append(join(dirname(__file__), "./raccoon")) from raccoon.utils.builders import evaluator_from_dict, NameBuilder for configuration in args.configurations: conf = load_configuration(configuration) if not conf.verbose: # disable Tensorflow logging os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' # disable Python warnings if not sys.warnoptions: warnings.simplefilter("ignore") name_builder = NameBuilder() evaluator = evaluator_from_dict(conf._asdict(), name_builder) if conf.cv_method == "loocv": evaluator.loocv() elif conf.cv_method == "k2": evaluator.kfold(k=2) elif conf.cv_method == "k10": evaluator.kfold(k=10) elif conf.cv_method == 'defined': evaluator.defined(conf.test_records)