Naive Last-Value Forecast Baseline

~8 mincode completion

Implement naive_forecast_mae(series, split) returning the MAE of the last-value forecast over the test steps, as a float. Assume .

Where this shows up

~8 min

8 employers weight this skill

3 quant funds, 2 big tech firms, 1 health and bio company, 1 AI product company, 1 defense company. Top match scores 75.

Python
import numpy as np


def naive_forecast_mae(series, split):
    """
    Score the last-value forecast on the test part of a series.

    Args:
        series: array of shape (n,), in time order
        split:  index s of the first test step, 1 <= s < n

    Returns:
        float: mean of |y[t] - y[t-1]| for t = s, ..., n-1
    """
    # YOUR CODE HERE
    pass

Run your code to see results

⌘↵ runs against the visible tests

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.