def main(self): self.data = self.parser.parse_args() logging.basicConfig(level=self.data.verbose) logger = logging.getLogger('b4msa') logger.setLevel(self.data.verbose) params_fname = self.data.params_fname param_list = load_json(params_fname) best = param_list[0] svc = SVC.fit_from_file(self.data.training_set, best) with open(self.get_output(), 'wb') as fpt: pickle.dump(svc, fpt)
def main(self): self.data = self.parser.parse_args() params_fname = self.data.params_fname if params_fname is not None: best = load_json(params_fname) if isinstance(best, list): best = best[0] else: best = dict() best = clean_params(best) kw = json.loads(self.data.kwargs) if self.data.kwargs is not None else dict() best.update(kw) svc = SVC.fit_from_file(self.data.training_set, best) save_model(svc, self.get_output())
def main(self): self.data = self.parser.parse_args() logging.basicConfig(level=self.data.verbose) params_fname = self.data.params_fname if params_fname.endswith('.gz'): with gzip.open(params_fname) as fpt: cdn = fpt.read() param_list = json.loads(str(cdn, encoding='utf-8')) else: with open(params_fname) as fpt: param_list = json.loads(fpt.read()) best = param_list[0] svc = SVC.fit_from_file(self.data.training_set, best) with open(self.get_output(), 'wb') as fpt: pickle.dump(svc, fpt)