deephyper.ensemble.aggregator.MeanAggregator#
- class deephyper.ensemble.aggregator.MeanAggregator(with_uncertainty: bool = False)[source]#
Bases:
Aggregator
Aggregate predictions using the mean. Supports both NumPy arrays and masked arrays.
Array (Fixed Set)
MaskedArray
✅
✅
- Parameters:
with_uncertainty (bool, optional) – a boolean that sets if the uncertainty should be returned when calling the aggregator. Defaults to
False
.
Methods
Aggregate predictions using the mean.
- aggregate(y: List[ndarray | MaskedArray], weights: List[float] | None = None) ndarray | MaskedArray [source]#
Aggregate predictions using the mean.
- Parameters:
y (List[np.ndarray | np.ma.MaskedArray]) – List of prediction arrays, each of shape
(n_samples, n_outputs)
.weights (Optional[List[float]]) – Optional weights for the predictors. If provided, must have the same length as y.
- Returns:
Aggregated predictions of shape
(n_samples, n_outputs)
.- Return type:
np.ndarray
- Raises:
ValueError – If weights length does not match the number of predictors in y.