Skip to content

Commit

Permalink
Return noise prediction *and* uncertainty of this prediction
Browse files Browse the repository at this point in the history
  • Loading branch information
ziatdinovmax committed Nov 26, 2024
1 parent 02308c4 commit 0b59e60
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions neurobayes/models/bnn_heteroskedastic.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,13 @@ def prior(name, shape):

def predict_noise(self, X_new: jnp.ndarray,
device: Optional[str] = None) -> jnp.ndarray:
"""Predict likely values of noise for new data"""
"""
Predict likely values of noise for new data
and associated uncertainty in the noise prediction
"""
X_new = self.set_data(X_new)
samples = self.get_samples()
X_new, samples = put_on_device(device, X_new, samples)
pred = self.sample_from_posterior(
jra.PRNGKey(0), X_new, samples, return_sites=['sig'])
return pred['sig'].mean(0)
return pred['sig'].mean(0), pred['sig'].var(0)

0 comments on commit 0b59e60

Please sign in to comment.