具有位置 loc 和 scale 參數的正態分布。
繼承自:Distribution
用法
tf.compat.v1.distributions.Normal(
    loc, scale, validate_args=False, allow_nan_stats=True, name='Normal'
)參數
- 
loc浮點張量;分布的手段。
- 
scale浮點張量;發行版的標準開發者。必須隻包含正值。
- 
validate_argsPythonbool,默認False。盡管可能會降低運行時性能,但檢查True分發參數的有效性時。當False無效輸入可能會默默呈現不正確的輸出。
- 
allow_nan_statsPythonbool,默認True。當True時,統計信息(例如,均值、眾數、方差)使用值“NaN”來指示結果未定義。當False時,如果一個或多個統計數據的批處理成員未定義,則會引發異常。
- 
namePythonstr名稱以此類創建的 Ops 為前綴。
拋出
- 
TypeError如果loc和scale有不同的dtype。
屬性
- 
allow_nan_statsPythonbool說明未定義統計信息時的行為。統計數據在有意義時返回 +/- 無窮大。例如,柯西分布的方差是無窮大的。但是,有時統計數據是未定義的,例如,如果分布的 pdf 在分布的支持範圍內沒有達到最大值,則模式是未定義的。如果均值未定義,則根據定義,方差未定義。例如: df = 1 的 Student's T 的平均值是未定義的(沒有明確的方式說它是 + 或 - 無窮大),因此方差 = E[(X - mean)**2] 也是未定義的。 
- 
batch_shape來自單個事件索引的單個樣本的形狀作為TensorShape.可能部分定義或未知。 批次維度是該分布的獨立、不同參數化的索引。 
- 
dtypeTensor的DType由此Distribution處理。
- 
event_shape單個批次的單個樣品的形狀作為TensorShape.可能部分定義或未知。 
- 
loc均值的分布參數。
- 
name此Distribution創建的所有操作前的名稱。
- 
parameters用於實例化此Distribution的參數字典。
- 
reparameterization_type說明如何重新參數化分布中的樣本。目前這是靜態實例 distributions.FULLY_REPARAMETERIZED或distributions.NOT_REPARAMETERIZED之一。
- 
scale標準差的分布參數。
- 
validate_argsPythonbool表示啟用了可能昂貴的檢查。
數學細節
概率密度函數 (pdf) 是,
pdf(x; mu, sigma) = exp(-0.5 (x - mu)**2 / sigma**2) / Z
Z = (2 pi sigma**2)**0.5其中loc = mu 是平均值,scale = sigma 是標準差。偏差,並且,Z 是歸一化常數。
正態分布是 location-scale 係列的成員,即,它可以構造為,
X ~ Normal(loc=0, scale=1)
Y = loc + scale * X例子
一個或一批分布的初始化示例。
import tensorflow_probability as tfp
tfd = tfp.distributions
# Define a single scalar Normal distribution.
dist = tfd.Normal(loc=0., scale=3.)
# Evaluate the cdf at 1, returning a scalar.
dist.cdf(1.)
# Define a batch of two scalar valued Normals.
# The first has mean 1 and standard deviation 11, the second 2 and 22.
dist = tfd.Normal(loc=[1, 2.], scale=[11, 22.])
# Evaluate the pdf of the first distribution on 0, and the second on 1.5,
# returning a length two tensor.
dist.prob([0, 1.5])
# Get 3 samples, returning a 3 x 2 tensor.
dist.sample([3])盡可能廣播參數。
# Define a batch of two scalar valued Normals.
# Both have mean 1, but different standard deviations.
dist = tfd.Normal(loc=1., scale=[11, 22.])
# Evaluate the pdf of both distributions on the same point, 3.0,
# returning a length 2 tensor.
dist.prob(3.0)相關用法
- Python tf.compat.v1.distributions.Normal.log_survival_function用法及代碼示例
- Python tf.compat.v1.distributions.Normal.log_cdf用法及代碼示例
- Python tf.compat.v1.distributions.Normal.quantile用法及代碼示例
- Python tf.compat.v1.distributions.Normal.stddev用法及代碼示例
- Python tf.compat.v1.distributions.Normal.kl_divergence用法及代碼示例
- Python tf.compat.v1.distributions.Normal.covariance用法及代碼示例
- Python tf.compat.v1.distributions.Normal.variance用法及代碼示例
- Python tf.compat.v1.distributions.Normal.survival_function用法及代碼示例
- Python tf.compat.v1.distributions.Normal.cdf用法及代碼示例
- Python tf.compat.v1.distributions.Normal.cross_entropy用法及代碼示例
- Python tf.compat.v1.distributions.Multinomial.stddev用法及代碼示例
- Python tf.compat.v1.distributions.Bernoulli.cross_entropy用法及代碼示例
- Python tf.compat.v1.distributions.Bernoulli.covariance用法及代碼示例
- Python tf.compat.v1.distributions.Laplace.stddev用法及代碼示例
- Python tf.compat.v1.distributions.Multinomial.quantile用法及代碼示例
- Python tf.compat.v1.distributions.Uniform.log_survival_function用法及代碼示例
- Python tf.compat.v1.distributions.Gamma.cdf用法及代碼示例
- Python tf.compat.v1.distributions.Gamma.log_cdf用法及代碼示例
- Python tf.compat.v1.distributions.Laplace.cross_entropy用法及代碼示例
- Python tf.compat.v1.distributions.Dirichlet.covariance用法及代碼示例
注:本文由純淨天空篩選整理自tensorflow.org大神的英文原創作品 tf.compat.v1.distributions.Normal。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。
