def tune(self): """Fuction to tune the hyper-parameters for the model using training and validation set.""" # getting the customized configurations from the command-line arguments. args = KGETuneArgParser().get_args([]) args.model = self.model args.dataset_name = self.dataset args.debug = self.debug # initializing bayesian optimizer and prepare data. bays_opt = BaysOptimizer(args=args) # perform the golden hyperparameter tuning. bays_opt.optimize() self.best = bays_opt.return_best()
def tunning_function(name): """Function to test the tuning of the models.""" knowledge_graph = KnowledgeGraph(dataset="freebase15k") knowledge_graph.prepare_data() # getting the customized configurations from the command-line arguments. args = KGETuneArgParser().get_args([]) # initializing bayesian optimizer and prepare data. args.debug = True args.model = name bays_opt = BaysOptimizer(args=args) bays_opt.trainer.config.test_num = 10 # perform the golden hyperparameter tuning. bays_opt.optimize()