diff options
Diffstat (limited to 'tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.distributions.Distribution.md')
-rw-r--r-- | tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.distributions.Distribution.md | 82 |
1 files changed, 42 insertions, 40 deletions
diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.distributions.Distribution.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.distributions.Distribution.md index a2658ef44b..0076cdc4ff 100644 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.distributions.Distribution.md +++ b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.distributions.Distribution.md @@ -6,8 +6,8 @@ A generic probability distribution base class. ### Subclassing Subclasses are expected to implement a leading-underscore version of the -same-named function. The argument signature should be identical except for -the omission of `name="..."`. For example, to enable `log_prob(value, +same-named function. The argument signature should be identical except for +the omission of `name="..."`. For example, to enable `log_prob(value, name="log_prob")` a subclass should implement `_log_prob(value)`. Subclasses can append to public-level docstrings by providing @@ -20,7 +20,7 @@ def _log_prob(self, value): ``` would add the string "Some other details." to the `log_prob` function -docstring. This is implemented as a simple decorator to avoid python +docstring. This is implemented as a simple decorator to avoid python linter complaining about missing Args/Returns/Raises sections in the partial docstrings. @@ -33,7 +33,7 @@ The shape of arguments to `__init__`, `cdf`, `log_cdf`, `prob`, and `log_prob` reflect this broadcasting, as does the return value of `sample` and `sample_n`. -`sample_n_shape = (n,) + batch_shape + event_shape`, where `sample_n_shape` is +`sample_n_shape = [n] + batch_shape + event_shape`, where `sample_n_shape` is the shape of the `Tensor` returned from `sample_n`, `n` is the number of samples, `batch_shape` defines how many independent distributions there are, and `event_shape` defines the shape of samples from each of those independent @@ -58,19 +58,19 @@ event_shape = u.event_shape # `event_shape_t` is a `Tensor` which will evaluate to []. event_shape_t = u.event_shape_tensor() -# Sampling returns a sample per distribution. `samples` has shape -# (5, 2, 2), which is (n,) + batch_shape + event_shape, where n=5, -# batch_shape=(2, 2), and event_shape=(). +# Sampling returns a sample per distribution. `samples` has shape +# [5, 2, 2], which is [n] + batch_shape + event_shape, where n=5, +# batch_shape=[2, 2], and event_shape=[]. samples = u.sample_n(5) # The broadcasting holds across methods. Here we use `cdf` as an example. The # same holds for `log_cdf` and the likelihood functions. -# `cum_prob` has shape (2, 2) as the `value` argument was broadcasted to the +# `cum_prob` has shape [2, 2] as the `value` argument was broadcasted to the # shape of the `Uniform` instance. cum_prob_broadcast = u.cdf(4.0) -# `cum_prob`'s shape is (2, 2), one per distribution. No broadcasting +# `cum_prob`'s shape is [2, 2], one per distribution. No broadcasting # occurred. cum_prob_per_dist = u.cdf([[4.0, 5.0], [6.0, 7.0]]) @@ -83,9 +83,9 @@ cum_prob_invalid = u.cdf([4.0, 5.0, 6.0]) ### Parameter values leading to undefined statistics or distributions. Some distributions do not have well-defined statistics for all initialization -parameter values. For example, the beta distribution is parameterized by -positive real numbers `a` and `b`, and does not have well-defined mode if -`a < 1` or `b < 1`. +parameter values. For example, the beta distribution is parameterized by +positive real numbers `concentration1` and `concentration0`, and does not have +well-defined mode if `concentration1 < 1` or `concentration0 < 1`. The user is given the option of raising an exception or returning `NaN`. @@ -122,25 +122,28 @@ Constructs the `Distribution`. * <b>`dtype`</b>: The type of the event samples. `None` implies no type-enforcement. -* <b>`is_continuous`</b>: Python boolean. If `True` this - `Distribution` is continuous over its supported domain. +* <b>`is_continuous`</b>: Python `bool`. If `True` this `Distribution` is continuous + over its supported domain. * <b>`reparameterization_type`</b>: Instance of `ReparameterizationType`. If `distributions.FULLY_REPARAMETERIZED`, this `Distribution` can be reparameterized in terms of some standard distribution with a function whose Jacobian is constant for the support - of the standard distribution. If `distributions.NOT_REPARAMETERIZED`, + of the standard distribution. If `distributions.NOT_REPARAMETERIZED`, then no such reparameterization is available. -* <b>`validate_args`</b>: Python boolean. Whether to validate input with asserts. - If `validate_args` is `False`, and the inputs are invalid, - correct behavior is not guaranteed. -* <b>`allow_nan_stats`</b>: Python boolean. If `False`, raise an - exception if a statistic (e.g., mean, mode) is undefined for any batch - member. If True, batch members with valid parameters leading to - undefined statistics will return `NaN` for this statistic. -* <b>`parameters`</b>: Python dictionary of parameters used to instantiate this +* <b>`validate_args`</b>: Python `bool`, default `False`. When `True` distribution + parameters are checked for validity despite possibly degrading runtime + performance. When `False` invalid inputs may silently render incorrect + outputs. +* <b>`allow_nan_stats`</b>: Python `bool`, default `True`. When `True`, statistics + (e.g., mean, mode, variance) use the value "`NaN`" to indicate the + result is undefined. When `False`, an exception is raised if one or + more of the statistic's batch members are undefined. +* <b>`parameters`</b>: Python `dict` of parameters used to instantiate this `Distribution`. -* <b>`graph_parents`</b>: Python list of graph prerequisites of this `Distribution`. -* <b>`name`</b>: A name for this distribution. Default: subclass name. +* <b>`graph_parents`</b>: Python `list` of graph prerequisites of this + `Distribution`. +* <b>`name`</b>: Python `str` name prefixed to Ops created by this class. Default: + subclass name. ##### Raises: @@ -152,21 +155,20 @@ Constructs the `Distribution`. #### `tf.contrib.distributions.Distribution.allow_nan_stats` {#Distribution.allow_nan_stats} -Python boolean describing behavior when a stat is undefined. +Python `bool` describing behavior when a stat is undefined. -Stats return +/- infinity when it makes sense. E.g., the variance -of a Cauchy distribution is infinity. However, sometimes the -statistic is undefined, e.g., if a distribution's pdf does not achieve a -maximum within the support of the distribution, the mode is undefined. -If the mean is undefined, then by definition the variance is undefined. -E.g. the mean for Student's T for df = 1 is undefined (no clear way to say -it is either + or - infinity), so the variance = E[(X - mean)^2] is also -undefined. +Stats return +/- infinity when it makes sense. E.g., the variance of a +Cauchy distribution is infinity. However, sometimes the statistic is +undefined, e.g., if a distribution's pdf does not achieve a maximum within +the support of the distribution, the mode is undefined. If the mean is +undefined, then by definition the variance is undefined. E.g. the mean for +Student's T for df = 1 is undefined (no clear way to say it is either + or - +infinity), so the variance = E[(X - mean)**2] is also undefined. ##### Returns: -* <b>`allow_nan_stats`</b>: Python boolean. +* <b>`allow_nan_stats`</b>: Python `bool`. - - - @@ -364,7 +366,7 @@ Indicates that `batch_shape == []`. ##### Returns: -* <b>`is_scalar_batch`</b>: `Boolean` `scalar` `Tensor`. +* <b>`is_scalar_batch`</b>: `bool` scalar `Tensor`. - - - @@ -381,7 +383,7 @@ Indicates that `event_shape == []`. ##### Returns: -* <b>`is_scalar_event`</b>: `Boolean` `scalar` `Tensor`. +* <b>`is_scalar_event`</b>: `bool` scalar `Tensor`. - - - @@ -514,8 +516,8 @@ param_shapes with static (i.e. `TensorShape`) shapes. This is a class method that describes what key/value arguments are required to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that -the sample's shape is known statically. +returned for that instance's call to `sample()`. Assumes that the sample's +shape is known statically. Subclasses should override class method `_param_shapes` to return constant-valued tensors when constant values are fed. @@ -656,7 +658,7 @@ survival_function(x) = P[X > x] #### `tf.contrib.distributions.Distribution.validate_args` {#Distribution.validate_args} -Python boolean indicated possibly expensive checks are enabled. +Python `bool` indicating possibly expensive checks are enabled. - - - |