Open mnozary opened 5 years ago
I recognize this example from Bayesian Methods for Hackers. If you're reading it, I'll point you to this code cell, which produces that plot.
I'm not sure what your problem is, exactly (providing code would help 🙂), but it does look like you're confusing credible intervals with confidence intervals. The difference is important, and in Bayesian statistics one will report a credible interval (also called "credibility interval" and related to the "region of highest posterior density (HPD)"). This answer on stack overflow provides an explanation on the difference between credible and confidence intervals.
In the code in that notebook they:
alpha
and beta
, which are parameters for the logistic curvealpha
and beta
samples at the desired temperaturesHopefully that cleared some things up. I recommend going through that notebook. Also, apologies if I went over something you already knew. I didn't answer your question directly, since it looks like there were some fundamental (and very common!) misunderstandings.
Note: your question is likely better-suited for stack overflow, but I couldn't find anything on credible intervals, so I decided to answer it here
The question is relevant and still in effect. If you use tfpl.IndependentNormal()
as the output layer, you will get a tf distribution object, and it is expected to have a .quantile()
method. But it doesn't. It gives
NotImplementedError: quantile is not implemented: Independent
Hello, in case it helps, I worked around this fact by extending the tfp.distributions.Independent
class for cases where I know that the underlying distribution has a quantile()
method implemented.
class IndependentWithQuantile(tfp.distributions.Independent):
def _quantile(self, value, **kwargs):
return self.distribution.quantile(value, **kwargs)
Out of curiosity, could anyone explain why doesn't tfp.distributions.Independent
automatically check whether the underlying distribution has a quantile()
method implemented and inherit where possible?
I test the following code:
TFP Probabilistic Layers: Regression
In "Custom PSD Kernel" section, I got yhat as the prediction for the test data.
My purpose is to have a confidence interval for this prediction. If I want to calculate the variance or quantile for this prediction with the variance and quantile methods, respectively, I will get the following error:
NotImplementedError: variance is not implemented: TransformedDistribution NotImplementedError: quantile is not implemented: Independent Therefore my question is:
How can I obtain the confidence interval for this prediction?
I need something like the following picture [Confidence Interval for the prediction (yhat.mean())]:
Thanks for your help!