具有low 和high 參數的均勻分布。
繼承自:Distribution
用法
tf.compat.v1.distributions.Uniform(
low=0.0, high=1.0, validate_args=False, allow_nan_stats=True,
name='Uniform'
)參數
-
low浮點張量,輸出區間的下邊界。必須有low < high。 -
high浮點張量,輸出區間的上邊界。必須有low < high。 -
validate_argsPythonbool,默認False。盡管可能會降低運行時性能,但檢查True分發參數的有效性時。當False無效輸入可能會默默呈現不正確的輸出。 -
allow_nan_statsPythonbool,默認True。當True時,統計信息(例如,均值、眾數、方差)使用值“NaN”來指示結果未定義。當False時,如果一個或多個統計數據的批處理成員未定義,則會引發異常。 -
namePythonstr名稱以此類創建的 Ops 為前綴。
拋出
-
InvalidArgumentError如果low >= high和validate_args=False。
屬性
-
allow_nan_statsPythonbool說明未定義統計信息時的行為。統計數據在有意義時返回 +/- 無窮大。例如,柯西分布的方差是無窮大的。但是,有時統計數據是未定義的,例如,如果分布的 pdf 在分布的支持範圍內沒有達到最大值,則模式是未定義的。如果均值未定義,則根據定義,方差未定義。例如: df = 1 的 Student's T 的平均值是未定義的(沒有明確的方式說它是 + 或 - 無窮大),因此方差 = E[(X - mean)**2] 也是未定義的。
-
batch_shape來自單個事件索引的單個樣本的形狀作為TensorShape.可能部分定義或未知。
批次維度是該分布的獨立、不同參數化的索引。
-
dtypeTensor的DType由此Distribution處理。 -
event_shape單個批次的單個樣品的形狀作為TensorShape.可能部分定義或未知。
-
high輸出區間的上邊界。 -
low輸出區間的下邊界。 -
name此Distribution創建的所有操作前的名稱。 -
parameters用於實例化此Distribution的參數字典。 -
reparameterization_type說明如何重新參數化分布中的樣本。目前這是靜態實例
distributions.FULLY_REPARAMETERIZED或distributions.NOT_REPARAMETERIZED之一。 -
validate_argsPythonbool表示啟用了可能昂貴的檢查。
數學細節
概率密度函數 (pdf) 是,
pdf(x; a, b) = I[a <= x < b] / Z
Z = b - a
其中
low = a,high = b,Z是歸一化常數,並且I[predicate]是predicate的指標函數。
參數 low 和 high 必須以支持廣播的方式進行整形(例如,high - low 是有效的操作)。
例子
# Without broadcasting:
u1 = Uniform(low=3.0, high=4.0) # a single uniform distribution [3, 4]
u2 = Uniform(low=[1.0, 2.0],
high=[3.0, 4.0]) # 2 distributions [1, 3], [2, 4]
u3 = Uniform(low=[[1.0, 2.0],
[3.0, 4.0]],
high=[[1.5, 2.5],
[3.5, 4.5]]) # 4 distributions# With broadcasting:
u1 = Uniform(low=3.0, high=[5.0, 6.0, 7.0]) # 3 distributions
相關用法
- Python tf.compat.v1.distributions.Uniform.log_survival_function用法及代碼示例
- Python tf.compat.v1.distributions.Uniform.kl_divergence用法及代碼示例
- Python tf.compat.v1.distributions.Uniform.covariance用法及代碼示例
- Python tf.compat.v1.distributions.Uniform.log_cdf用法及代碼示例
- Python tf.compat.v1.distributions.Uniform.survival_function用法及代碼示例
- Python tf.compat.v1.distributions.Uniform.variance用法及代碼示例
- Python tf.compat.v1.distributions.Uniform.stddev用法及代碼示例
- Python tf.compat.v1.distributions.Uniform.cdf用法及代碼示例
- Python tf.compat.v1.distributions.Uniform.cross_entropy用法及代碼示例
- Python tf.compat.v1.distributions.Uniform.quantile用法及代碼示例
- 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.Normal.log_survival_function用法及代碼示例
- Python tf.compat.v1.distributions.Laplace.stddev用法及代碼示例
- Python tf.compat.v1.distributions.Multinomial.quantile用法及代碼示例
- Python tf.compat.v1.distributions.Gamma.cdf用法及代碼示例
- Python tf.compat.v1.distributions.Normal.log_cdf用法及代碼示例
- Python tf.compat.v1.distributions.Gamma.log_cdf用法及代碼示例
- Python tf.compat.v1.distributions.Laplace.cross_entropy用法及代碼示例
注:本文由純淨天空篩選整理自tensorflow.org大神的英文原創作品 tf.compat.v1.distributions.Uniform。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。
