Join Our 5-Week ML/AI Engineer Interview Bootcamp 🚀 led by ML Tech Leads at FAANGs
Implement ensemble averaging to combine predictions from multiple ML models into one final prediction. You’ll take a list of per-model predictions and return the averaged prediction, which is a simple but common baseline for improving stability.
Ensemble averaging is defined as:
Implement the function
Rules:
Output:
| Argument | Type |
|---|---|
| predictions | np.ndarray |
| Return Name | Type |
|---|---|
| value | np.ndarray |
Use NumPy; no sklearn ensembling utilities.
Average across models dimension (axis=0).
Return np.ndarray[float].
Ensure predictions is a 2D NumPy array of float.
Use np.mean(..., axis=0) to average across models (rows) for each item (column).
Return the result as a NumPy array; ensure output length equals one model’s list.