Skip to content

Commit 14a718c

Browse files
committed
fix: remove heuristic aleatoric split
1 parent 71979bf commit 14a718c

File tree

1 file changed

+8
-18
lines changed

1 file changed

+8
-18
lines changed

src/UncertaintyQuantification/BayesianNeuralNetworks/DeepEnsemble.cs

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -103,19 +103,19 @@ public UncertaintyPredictionResult<T, Tensor<T>> PredictWithUncertainty(Tensor<T
103103
/// <b>For Beginners:</b> If each model in the ensemble outputs both a prediction and
104104
/// its own uncertainty estimate (e.g., Gaussian likelihood), the average of individual
105105
/// model uncertainties represents aleatoric uncertainty (data noise).
106+
///
107+
/// <b>Important:</b> This implementation does not currently have per-model variance heads, so a true
108+
/// aleatoric/epistemic decomposition is not available. As a conservative default, this method returns
109+
/// zeros; to estimate aleatoric uncertainty, modify ensemble members to output explicit variance (e.g.,
110+
/// a Gaussian likelihood head).
106111
/// </remarks>
107112
public Tensor<T> EstimateAleatoricUncertainty(Tensor<T> input)
108113
{
109114
var totalUncertainty = PredictWithUncertainty(input).Variance ?? new Tensor<T>(input.Shape);
110-
111-
// In a basic ensemble, we approximate aleatoric as a fraction of total variance
112-
// In practice, each model could output its own variance estimate
113115
var aleatoric = new Tensor<T>(totalUncertainty.Shape);
114-
var aleatoricFactor = _numOps.FromDouble(0.3);
115-
116-
for (int i = 0; i < totalUncertainty.Length; i++)
116+
for (int i = 0; i < aleatoric.Length; i++)
117117
{
118-
aleatoric[i] = _numOps.Multiply(totalUncertainty[i], aleatoricFactor);
118+
aleatoric[i] = _numOps.Zero;
119119
}
120120

121121
return aleatoric;
@@ -134,17 +134,7 @@ public Tensor<T> EstimateAleatoricUncertainty(Tensor<T> input)
134134
public Tensor<T> EstimateEpistemicUncertainty(Tensor<T> input)
135135
{
136136
var totalUncertainty = PredictWithUncertainty(input).Variance ?? new Tensor<T>(input.Shape);
137-
138-
// Ensemble disagreement primarily captures epistemic uncertainty
139-
var epistemic = new Tensor<T>(totalUncertainty.Shape);
140-
var epistemicFactor = _numOps.FromDouble(0.7);
141-
142-
for (int i = 0; i < totalUncertainty.Length; i++)
143-
{
144-
epistemic[i] = _numOps.Multiply(totalUncertainty[i], epistemicFactor);
145-
}
146-
147-
return epistemic;
137+
return totalUncertainty;
148138
}
149139

150140
/// <summary>

0 commit comments

Comments
 (0)