def train(self, opt_path: str = "./config/default.json"): opt = load_opt(opt_path) results = {} results["SVM"] = _train_svm(opt) results["AE"] = _train_ae(opt) results["MLP"] = _train_mlp(opt) pprint.pprint(results)
def finetuning(self, opt_path: str = "./config/default.json"): opt = load_opt(opt_path) results = {} for model_name, Trainer in TRAINER_MAP.items(): if model_name == "AE": hps = combine_hps(True) else: hps = combine_hps(False) for hp in hps: for k, v in hp.items(): opt[k] = v trainer = Trainer(opt) result = trainer.train() if model_name not in results.keys(): results[model_name] = result elif results[model_name]["avg_accuracy"] < result["avg_accuracy"]: results[model_name] = result results["SVM"] = _train_svm(opt) pprint.pprint(results)
def visualize(self, opt_path: str = "./config/default.json" , data_path: str = "./syncdiff/data/data.json"): opt = load_opt(opt_path) visualize_raw_data(data_path, opt["saved_folder"])
def train_mlp(self, opt_path: str = "./config/default.json"): opt = load_opt(opt_path) result = _train_mlp(opt) pprint.pprint(result)