The regression version of the majority-class baseline predicts the same value for every example. The best constant under squared error is the training mean. A regression model should beat it, and R-squared score is defined so that this baseline scores exactly zero.
Implement mean_regressor_baseline(y_train, n_samples), which returns an array of length n_samples filled with the mean of y_train as a float.
y_train must not be empty: raise ValueError.y_train holds integers.y_train.Open one at a time. Each gives away a little more than the last.
Convert y_train to a float array first, then take its mean.
np.full(n_samples, value) builds the constant array in one call.
No results yet
Run your code to check it against the examples, or submit to run every test.