def best_validation_rows(log_df, valid_col='valid_accuracy', second_criterion='iterations_done'):
    """
    Takes a dataframe created by scripts/logs_to_dataframe.py and returns
    a dataframe containing the best-validation row for each log.
    """
    return log_df.sort_values([valid_col,second_criterion],ascending=False).drop_duplicates(['log'])