Early Stopping with Patience

~10 mincode completion

Implement early_stopping(val_losses, patience) returning the array [best_epoch, stop_epoch], both 1-based.

Where this shows up

~10 min

8 employers weight this skill

4 frontier labs, 2 big tech firms, 1 autonomy company, 1 enterprise vendor. Top match scores 81.

Python
import numpy as np


def early_stopping(val_losses, patience):
    """
    Where early stopping keeps its checkpoint and where it ends the run.

    Args:
        val_losses: validation loss after each epoch, shape (n,)
        patience:   epochs without a new best before stopping

    Returns:
        array [best_epoch, stop_epoch], both counted from 1
    """
    # YOUR CODE HERE
    pass
Loading docs…

The AI Mentor needs an account

It reads your code and the failing tests and nudges you toward the fix without handing you the answer. Free accounts get it on every problem you're working on today.