Type Bernoulli
Namespace tensorflow.distributions
Parent Distribution
Interfaces IBernoulli
Bernoulli distribution. The Bernoulli distribution with `probs` parameter, i.e., the probability of a
`1` outcome (vs a `0` outcome).
Methods
- cdf
- cdf
- cdf
- cdf
- cdf
- cdf
- cdf_dyn
- copy
- copy_dyn
- event_shape_tensor
- event_shape_tensor_dyn
- is_scalar_batch
- is_scalar_batch_dyn
- is_scalar_event
- is_scalar_event_dyn
- log_cdf
- log_cdf
- log_cdf
- log_cdf
- log_cdf
- log_cdf_dyn
- log_prob
- log_prob_dyn
- log_survival_function
- NewDyn
- prob
- prob
- prob
- prob
- prob
- prob_dyn
- sample
- sample
- sample
- sample
- sample
- sample_dyn
Properties
Public instance methods
object cdf(double value, string name)
Cumulative distribution function. Given random variable `X`, the cumulative distribution function `cdf` is: ```none
cdf(x) := P[X <= x]
```
Parameters
-
double
value - `float` or `double` `Tensor`.
-
string
name - Python `str` prepended to names of ops created by this function.
Returns
-
object
object cdf(ndarray value, string name)
Cumulative distribution function. Given random variable `X`, the cumulative distribution function `cdf` is: ```none
cdf(x) := P[X <= x]
```
Parameters
-
ndarray
value - `float` or `double` `Tensor`.
-
string
name - Python `str` prepended to names of ops created by this function.
Returns
-
object
object cdf(IEnumerable<double> value, string name)
Cumulative distribution function. Given random variable `X`, the cumulative distribution function `cdf` is: ```none
cdf(x) := P[X <= x]
```
Parameters
-
IEnumerable<double>
value - `float` or `double` `Tensor`.
-
string
name - Python `str` prepended to names of ops created by this function.
Returns
-
object
object cdf(IGraphNodeBase value, string name)
Cumulative distribution function. Given random variable `X`, the cumulative distribution function `cdf` is: ```none
cdf(x) := P[X <= x]
```
Parameters
-
IGraphNodeBase
value - `float` or `double` `Tensor`.
-
string
name - Python `str` prepended to names of ops created by this function.
Returns
-
object
object cdf(int value, string name)
Cumulative distribution function. Given random variable `X`, the cumulative distribution function `cdf` is: ```none
cdf(x) := P[X <= x]
```
Parameters
-
int
value - `float` or `double` `Tensor`.
-
string
name - Python `str` prepended to names of ops created by this function.
Returns
-
object
object cdf(IndexedSlices value, string name)
Cumulative distribution function. Given random variable `X`, the cumulative distribution function `cdf` is: ```none
cdf(x) := P[X <= x]
```
Parameters
-
IndexedSlices
value - `float` or `double` `Tensor`.
-
string
name - Python `str` prepended to names of ops created by this function.
Returns
-
object
object cdf_dyn(object value, ImplicitContainer<T> name)
Cumulative distribution function. Given random variable `X`, the cumulative distribution function `cdf` is: ```none
cdf(x) := P[X <= x]
```
Parameters
-
object
value - `float` or `double` `Tensor`.
-
ImplicitContainer<T>
name - Python `str` prepended to names of ops created by this function.
Returns
-
object
object copy(IDictionary<string, object> override_parameters_kwargs)
Creates a deep copy of the distribution. Note: the copy distribution may continue to depend on the original
initialization arguments.
Parameters
-
IDictionary<string, object>
override_parameters_kwargs - String/value dictionary of initialization arguments to override with new values.
Returns
-
object
object copy_dyn(IDictionary<string, object> override_parameters_kwargs)
Creates a deep copy of the distribution. Note: the copy distribution may continue to depend on the original
initialization arguments.
Parameters
-
IDictionary<string, object>
override_parameters_kwargs - String/value dictionary of initialization arguments to override with new values.
Returns
-
object
Tensor event_shape_tensor(string name)
Shape of a single sample from a single batch as a 1-D int32 `Tensor`.
Parameters
-
string
name - name to give to the op
Returns
object event_shape_tensor_dyn(ImplicitContainer<T> name)
Shape of a single sample from a single batch as a 1-D int32 `Tensor`.
Parameters
-
ImplicitContainer<T>
name - name to give to the op
Returns
-
object
Tensor is_scalar_batch(string name)
Indicates that `batch_shape == []`.
Parameters
-
string
name - Python `str` prepended to names of ops created by this function.
Returns
object is_scalar_batch_dyn(ImplicitContainer<T> name)
Indicates that `batch_shape == []`.
Parameters
-
ImplicitContainer<T>
name - Python `str` prepended to names of ops created by this function.
Returns
-
object
Tensor is_scalar_event(string name)
Indicates that `event_shape == []`.
Parameters
-
string
name - Python `str` prepended to names of ops created by this function.
Returns
object is_scalar_event_dyn(ImplicitContainer<T> name)
Indicates that `event_shape == []`.
Parameters
-
ImplicitContainer<T>
name - Python `str` prepended to names of ops created by this function.
Returns
-
object
object log_cdf(IGraphNodeBase value, string name)
Log cumulative distribution function. Given random variable `X`, the cumulative distribution function `cdf` is: ```none
log_cdf(x) := Log[ P[X <= x] ]
``` Often, a numerical approximation can be used for `log_cdf(x)` that yields
a more accurate answer than simply taking the logarithm of the `cdf` when
`x << -1`.
Parameters
-
IGraphNodeBase
value - `float` or `double` `Tensor`.
-
string
name - Python `str` prepended to names of ops created by this function.
Returns
-
object
object log_cdf(IndexedSlices value, string name)
Log cumulative distribution function. Given random variable `X`, the cumulative distribution function `cdf` is: ```none
log_cdf(x) := Log[ P[X <= x] ]
``` Often, a numerical approximation can be used for `log_cdf(x)` that yields
a more accurate answer than simply taking the logarithm of the `cdf` when
`x << -1`.
Parameters
-
IndexedSlices
value - `float` or `double` `Tensor`.
-
string
name - Python `str` prepended to names of ops created by this function.
Returns
-
object
object log_cdf(IEnumerable<double> value, string name)
Log cumulative distribution function. Given random variable `X`, the cumulative distribution function `cdf` is: ```none
log_cdf(x) := Log[ P[X <= x] ]
``` Often, a numerical approximation can be used for `log_cdf(x)` that yields
a more accurate answer than simply taking the logarithm of the `cdf` when
`x << -1`.
Parameters
-
IEnumerable<double>
value - `float` or `double` `Tensor`.
-
string
name - Python `str` prepended to names of ops created by this function.
Returns
-
object
object log_cdf(ndarray value, string name)
Log cumulative distribution function. Given random variable `X`, the cumulative distribution function `cdf` is: ```none
log_cdf(x) := Log[ P[X <= x] ]
``` Often, a numerical approximation can be used for `log_cdf(x)` that yields
a more accurate answer than simply taking the logarithm of the `cdf` when
`x << -1`.
Parameters
-
ndarray
value - `float` or `double` `Tensor`.
-
string
name - Python `str` prepended to names of ops created by this function.
Returns
-
object
object log_cdf(double value, string name)
Log cumulative distribution function. Given random variable `X`, the cumulative distribution function `cdf` is: ```none
log_cdf(x) := Log[ P[X <= x] ]
``` Often, a numerical approximation can be used for `log_cdf(x)` that yields
a more accurate answer than simply taking the logarithm of the `cdf` when
`x << -1`.
Parameters
-
double
value - `float` or `double` `Tensor`.
-
string
name - Python `str` prepended to names of ops created by this function.
Returns
-
object
object log_cdf_dyn(object value, ImplicitContainer<T> name)
Log cumulative distribution function. Given random variable `X`, the cumulative distribution function `cdf` is: ```none
log_cdf(x) := Log[ P[X <= x] ]
``` Often, a numerical approximation can be used for `log_cdf(x)` that yields
a more accurate answer than simply taking the logarithm of the `cdf` when
`x << -1`.
Parameters
-
object
value - `float` or `double` `Tensor`.
-
ImplicitContainer<T>
name - Python `str` prepended to names of ops created by this function.
Returns
-
object
object log_prob(object value, string name)
Log probability density/mass function.
Parameters
-
object
value - `float` or `double` `Tensor`.
-
string
name - Python `str` prepended to names of ops created by this function.
Returns
-
object
object log_prob_dyn(object value, ImplicitContainer<T> name)
Log probability density/mass function.
Parameters
-
object
value - `float` or `double` `Tensor`.
-
ImplicitContainer<T>
name - Python `str` prepended to names of ops created by this function.
Returns
-
object
Tensor log_survival_function(ndarray value, string name)
Log survival function. Given random variable `X`, the survival function is defined: ```none
log_survival_function(x) = Log[ P[X > x] ]
= Log[ 1 - P[X <= x] ]
= Log[ 1 - cdf(x) ]
``` Typically, different numerical approximations can be used for the log
survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`.
Parameters
-
ndarray
value - `float` or `double` `Tensor`.
-
string
name - Python `str` prepended to names of ops created by this function.
Returns
-
Tensor
- `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type `self.dtype`.
object prob(int value, string name)
Probability density/mass function.
Parameters
-
int
value - `float` or `double` `Tensor`.
-
string
name - Python `str` prepended to names of ops created by this function.
Returns
-
object
object prob(IEnumerable<double> value, string name)
Probability density/mass function.
Parameters
-
IEnumerable<double>
value - `float` or `double` `Tensor`.
-
string
name - Python `str` prepended to names of ops created by this function.
Returns
-
object
object prob(ndarray value, string name)
Probability density/mass function.
Parameters
-
ndarray
value - `float` or `double` `Tensor`.
-
string
name - Python `str` prepended to names of ops created by this function.
Returns
-
object
object prob(double value, string name)
Probability density/mass function.
Parameters
-
double
value - `float` or `double` `Tensor`.
-
string
name - Python `str` prepended to names of ops created by this function.
Returns
-
object
object prob(IGraphNodeBase value, string name)
Probability density/mass function.
Parameters
-
IGraphNodeBase
value - `float` or `double` `Tensor`.
-
string
name - Python `str` prepended to names of ops created by this function.
Returns
-
object
object prob_dyn(object value, ImplicitContainer<T> name)
Probability density/mass function.
Parameters
-
object
value - `float` or `double` `Tensor`.
-
ImplicitContainer<T>
name - Python `str` prepended to names of ops created by this function.
Returns
-
object
object sample(IGraphNodeBase sample_shape, Nullable<int> seed, string name)
Generate samples of the specified shape. Note that a call to `sample()` without arguments will generate a single
sample.
Parameters
-
IGraphNodeBase
sample_shape - 0D or 1D `int32` `Tensor`. Shape of the generated samples.
-
Nullable<int>
seed - Python integer seed for RNG
-
string
name - name to give to the op.
Returns
-
object
object sample(int sample_shape, Nullable<int> seed, string name)
Generate samples of the specified shape. Note that a call to `sample()` without arguments will generate a single
sample.
Parameters
-
int
sample_shape - 0D or 1D `int32` `Tensor`. Shape of the generated samples.
-
Nullable<int>
seed - Python integer seed for RNG
-
string
name - name to give to the op.
Returns
-
object
object sample(ImplicitContainer<T> sample_shape, Nullable<int> seed, string name)
Generate samples of the specified shape. Note that a call to `sample()` without arguments will generate a single
sample.
Parameters
-
ImplicitContainer<T>
sample_shape - 0D or 1D `int32` `Tensor`. Shape of the generated samples.
-
Nullable<int>
seed - Python integer seed for RNG
-
string
name - name to give to the op.
Returns
-
object
object sample(ValueTuple<int, object> sample_shape, Nullable<int> seed, string name)
Generate samples of the specified shape. Note that a call to `sample()` without arguments will generate a single
sample.
Parameters
-
ValueTuple<int, object>
sample_shape - 0D or 1D `int32` `Tensor`. Shape of the generated samples.
-
Nullable<int>
seed - Python integer seed for RNG
-
string
name - name to give to the op.
Returns
-
object
object sample(IEnumerable<int> sample_shape, Nullable<int> seed, string name)
Generate samples of the specified shape. Note that a call to `sample()` without arguments will generate a single
sample.
Parameters
-
IEnumerable<int>
sample_shape - 0D or 1D `int32` `Tensor`. Shape of the generated samples.
-
Nullable<int>
seed - Python integer seed for RNG
-
string
name - name to give to the op.
Returns
-
object
object sample_dyn(ImplicitContainer<T> sample_shape, object seed, ImplicitContainer<T> name)
Generate samples of the specified shape. Note that a call to `sample()` without arguments will generate a single
sample.
Parameters
-
ImplicitContainer<T>
sample_shape - 0D or 1D `int32` `Tensor`. Shape of the generated samples.
-
object
seed - Python integer seed for RNG
-
ImplicitContainer<T>
name - name to give to the op.
Returns
-
object
Public static methods
Bernoulli NewDyn(object logits, object probs, ImplicitContainer<T> dtype, ImplicitContainer<T> validate_args, ImplicitContainer<T> allow_nan_stats, ImplicitContainer<T> name)
Initialize Categorical distributions using class log-probabilities. (deprecated) Warning: THIS FUNCTION IS DEPRECATED. It will be removed after 2019-01-01.
Instructions for updating:
The TensorFlow Distributions library has moved to TensorFlow Probability (https://github.com/tensorflow/probability). You should update all references to use `tfp.distributions` instead of
tf.distributions
.
Parameters
-
object
logits - An N-D `Tensor`, `N >= 1`, representing the log probabilities of a set of Categorical distributions. The first `N - 1` dimensions index into a batch of independent distributions and the last dimension represents a vector of logits for each class. Only one of `logits` or `probs` should be passed in.
-
object
probs - An N-D `Tensor`, `N >= 1`, representing the probabilities of a set of Categorical distributions. The first `N - 1` dimensions index into a batch of independent distributions and the last dimension represents a vector of probabilities for each class. Only one of `logits` or `probs` should be passed in.
-
ImplicitContainer<T>
dtype - The type of the event samples (default: int32).
-
ImplicitContainer<T>
validate_args - 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.
-
ImplicitContainer<T>
allow_nan_stats - 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.
-
ImplicitContainer<T>
name - Python `str` name prefixed to Ops created by this class.
Public properties
object allow_nan_stats get;
object allow_nan_stats_dyn get;
TensorShape batch_shape get;
object batch_shape_dyn get;
object dtype get;
object dtype_dyn get;
TensorShape event_shape get;
object event_shape_dyn get;
object logits get;
Log-odds of a `1` outcome (vs `0`).
object logits_dyn get;
Log-odds of a `1` outcome (vs `0`).
string name get;
object name_dyn get;
IDictionary<object, object> parameters get;
object parameters_dyn get;
Tensor probs get;
Probability of a `1` outcome (vs `0`).
object probs_dyn get;
Probability of a `1` outcome (vs `0`).