Spot Gradient Descent Divergence

~14 mincode completion

Implement bowl_descent(curvatures, theta0, lr, steps) that runs the update steps times and returns the array [final_loss, diverged], with diverged equal to 1.0 or 0.0.

Where this shows up

~14 min

3 employers weight this skill

1 big tech firm, 1 frontier lab, 1 quant fund. Top match scores 80.

Python
import numpy as np


def bowl_descent(curvatures, theta0, lr, steps):
    """
    Gradient descent on L = 0.5 * (c1 * t1^2 + c2 * t2^2).

    Args:
        curvatures: array [c1, c2], both positive
        theta0:     starting point [t1, t2]
        lr:         learning rate
        steps:      number of updates k (0 or more)

    Returns:
        array [final_loss, diverged], diverged 1.0 if final_loss > starting loss else 0.0
    """
    # 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.