Estimate the bias and variance of a model from the predictions of several models (for example trained on different bootstrap samples) on the same observations. predictions has shape (n_models, n_observations) and y holds the true targets.
Implement solve(predictions, y).
Returns. Return a tuple (squared_bias, variance). Squared bias is the mean over observations of (fˉ(x)−y)2, where fˉ is the average prediction across models. Variance is the mean over observations of the (population, ddof=0) variance of the predictions across models.
Example 1
Input:
solve([[2, 4], [4, 6]], [3, 5])
Output:
(0.0, 1.0)
Example 2
Input:
solve([[1.0, 2.0], [1.0, 2.0], [1.0, 2.0]], [0.0, 0.0])
Output:
(2.5, 0.0)
No results yet
Run your code to check it against the examples, or submit to run every test.