def minimize(self, model, data, max_evals):
        trials_list = self.compute_trials(model, data, max_evals)

        best_val = 1e7
        for trials in trials_list:
            for trial in trials:
                val = trial.get('result').get('loss')
                if val < best_val:
                    best_val = val
                    best_model_yaml = trial.get('result').get('model')
                    best_model_weights = trial.get('result').get('weights')

        best_model = model_from_yaml(best_model_yaml)
        best_model.set_weights(pickle.loads(best_model_weights))

        return best_model
dataset/ETHPy150Open maxpumperla/elephas/elephas/hyperparam.py/HyperParamModel.minimize/original