def early_stop(val_acc_history, k=10, required_progress=1e-4):
    """
    Stop the training if there is no non-trivial progress in k steps
    @param val_acc_history: a list contains all the historical validation acc
    @param required_progress: the next acc should be higher than the previous by 
        at least required_progress amount to be non-trivial
    @param t: number of training steps 
    @return: a boolean indicates if the model should earily stop
    """
    non_trivial = 1
    if len(val_acc_history)>=k+1:
        non_trivial = 0
        for i, acc in enumerate(val_acc_history):
            if i != len(val_acc_history) - 1:
                if val_acc_history[i+1]-acc < -required_progress:
                    non_trivial = 1
                    break
    return not non_trivial