Ensemble MethodsEasy
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