def get_best_hyperparameters(df_results, evaluation_metric, selection_function
    ):
    """ Based on the performance on the validation, select the best hyperparameters
    """
    hp_groups = df_results.groupby('hyperparameters_str')
    validation_evaluation_metric = 'validation_{}'.format(evaluation_metric)
    test_evaluation_metric = 'test_{}'.format(evaluation_metric)
    val_performance = hp_groups[validation_evaluation_metric].mean()
    val_best = selection_function(val_performance)
    return val_best
