Forest Prediction from Stumps

~12 mincode completion

Implement forest_predict(stumps, X) returning the forest's averaged prediction for every row of X.

Where this shows up

~12 min

8 employers weight this skill

2 big tech firms, 2 health and bio companies, 2 quant funds, 1 AI product company, 1 enterprise vendor. Top match scores 93.

Python
import numpy as np


def forest_predict(stumps, X):
    """
    Average the predictions of a forest of regression stumps.

    Args:
        stumps: array of shape (T, 4); row t is [feature, threshold, left_value, right_value]
        X:      array of shape (n, d)

    Returns:
        array of shape (n,): the mean of the T stump predictions per row
    """
    # 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.