tfp.distributions.normal_conjugates_known_scale_posterior
Stay organized with collections
Save and categorize content based on your preferences.
Posterior Normal distribution with conjugate prior on the mean.
tfp.distributions.normal_conjugates_known_scale_posterior(
prior, scale, s, n
)
This model assumes that n
observations (with sum s
) come from a
Normal with unknown mean loc
(described by the Normal prior
)
and known variance scale**2
. The "known scale posterior" is
the distribution of the unknown loc
.
Accepts a prior Normal distribution object, having parameters
loc0
and scale0
, as well as known scale
values of the predictive
distribution(s) (also assumed Normal),
and statistical estimates s
(the sum(s) of the observations) and
n
(the number(s) of observations).
Returns a posterior (also Normal) distribution object, with parameters
(loc', scale'**2)
, where:
mu ~ N(mu', sigma'**2)
sigma'**2 = 1/(1/sigma0**2 + n/sigma**2),
mu' = (mu0/sigma0**2 + s/sigma**2) * sigma'**2.
Distribution parameters from prior
, as well as scale
, s
, and n
.
will broadcast in the case of multidimensional sets of parameters.
Args |
prior
|
Normal object of type dtype :
the prior distribution having parameters (loc0, scale0) .
|
scale
|
tensor of type dtype , taking values scale > 0 .
The known stddev parameter(s).
|
s
|
Tensor of type dtype . The sum(s) of observations.
|
n
|
Tensor of type int . The number(s) of observations.
|
Returns |
A new Normal posterior distribution object for the unknown observation
mean loc .
|
Raises |
TypeError
|
if dtype of s does not match dtype , or prior is not a
Normal object.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-11-21 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2023-11-21 UTC."],[],[],null,["# tfp.distributions.normal_conjugates_known_scale_posterior\n\n\u003cbr /\u003e\n\n|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/probability/blob/v0.23.0/tensorflow_probability/python/distributions/normal_conjugate_posteriors.py#L149-L205) |\n\nPosterior Normal distribution with conjugate prior on the mean. \n\n tfp.distributions.normal_conjugates_known_scale_posterior(\n prior, scale, s, n\n )\n\nThis model assumes that `n` observations (with sum `s`) come from a\nNormal with unknown mean `loc` (described by the Normal `prior`)\nand known variance `scale**2`. The \"known scale posterior\" is\nthe distribution of the unknown `loc`.\n\nAccepts a prior Normal distribution object, having parameters\n`loc0` and `scale0`, as well as known `scale` values of the predictive\ndistribution(s) (also assumed Normal),\nand statistical estimates `s` (the sum(s) of the observations) and\n`n` (the number(s) of observations).\n\nReturns a posterior (also Normal) distribution object, with parameters\n`(loc', scale'**2)`, where: \n\n mu ~ N(mu', sigma'**2)\n sigma'**2 = 1/(1/sigma0**2 + n/sigma**2),\n mu' = (mu0/sigma0**2 + s/sigma**2) * sigma'**2.\n\nDistribution parameters from `prior`, as well as `scale`, `s`, and `n`.\nwill broadcast in the case of multidimensional sets of parameters.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|---------|---------------------------------------------------------------------------------------------|\n| `prior` | `Normal` object of type `dtype`: the prior distribution having parameters `(loc0, scale0)`. |\n| `scale` | tensor of type `dtype`, taking values `scale \u003e 0`. The known stddev parameter(s). |\n| `s` | Tensor of type `dtype`. The sum(s) of observations. |\n| `n` | Tensor of type `int`. The number(s) of observations. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| A new Normal posterior distribution object for the unknown observation mean `loc`. ||\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Raises ------ ||\n|-------------|----------------------------------------------------------------------------|\n| `TypeError` | if dtype of `s` does not match `dtype`, or `prior` is not a Normal object. |\n\n\u003cbr /\u003e"]]