deephyper.ensemble.aggregator.MixedCategoricalAggregator#
- class deephyper.ensemble.aggregator.MixedCategoricalAggregator(uncertainty_method: str = 'confidence', decomposed_uncertainty: bool = False)[source]#
Bases:
Aggregator
Aggregate a set of categorical distributions, supporting uncertainty estimation.
Array (Fixed Set)
MaskedArray
✅
✅
- Parameters:
uncertainty_method (str, optional) – Method to compute the uncertainty. Choices are
"confidence"
or"entropy"
. Default is"confidence"
. -"confidence"
: Uncertainty is computed as1 - max(probability)
. -"entropy"
: Uncertainty is computed as the entropy of the categorical distribution.decomposed_uncertainty (bool, optional) – If
True
, decomposes uncertainty into aleatoric and epistemic components. Default isFalse
.
Methods
Aggregate predictions using the mode of categorical distributions.
Attributes
VALID_UNCERTAINTY_METHODS
- aggregate(y: List[ndarray], weights: List[float] | None = None) Dict[str, ndarray | MaskedArray] [source]#
Aggregate predictions using the mode of categorical distributions.
- Parameters:
y (List[np.ndarray]) – List of categorical probability arrays of shape
(n_predictors, n_samples, ..., n_classes)
.weights (Optional[List[float]]) – Optional weights for the predictors. Must match the number of predictors. Default is
None
.
- Returns:
- Aggregated results, including:
"loc"
: Aggregated categorical probabilities of shape ``(n_samples, …,
n_classes)``.
"uncertainty"
: (Optional) Total uncertainty."uncertainty_aleatoric"
: (Optional) Aleatoric uncertainty."uncertainty_epistemic"
: (Optional) Epistemic uncertainty.
- Return type:
- Raises:
ValueError – If y dimensions are invalid or if weights length does not match y.