def __init__(self, concentration1=1., concentration0=1., validate_args=False, name="kumaraswamy"): """Instantiates the `Kumaraswamy` bijector. Args: concentration1: Python `float` scalar indicating the transform power, i.e., `Y = g(X) = (1 - (1 - X)**(1 / b))**(1 / a)` where `a` is `concentration1`. concentration0: Python `float` scalar indicating the transform power, i.e., `Y = g(X) = (1 - (1 - X)**(1 / b))**(1 / a)` where `b` is `concentration0`. validate_args: Python `bool` indicating whether arguments should be checked for correctness. name: Python `str` name given to ops managed by this object. """ with tf.name_scope(name) as name: dtype = dtype_util.common_dtype([concentration0, concentration1], dtype_hint=tf.float32) self._concentration0 = tensor_util.convert_nonref_to_tensor( concentration0, dtype=dtype, name="concentration0") self._concentration1 = tensor_util.convert_nonref_to_tensor( concentration1, dtype=dtype, name="concentration1") super(Kumaraswamy, self).__init__(forward_min_event_ndims=0, validate_args=validate_args, name=name)
def __init__(self, low=0., high=1., peak=0.5, validate_args=False, allow_nan_stats=True, name='Triangular'): """Initialize a batch of Triangular distributions. Args: low: Floating point tensor, lower boundary of the output interval. Must have `low < high`. Default value: `0`. high: Floating point tensor, upper boundary of the output interval. Must have `low < high`. Default value: `1`. peak: Floating point tensor, mode of the output interval. Must have `low <= peak` and `peak <= high`. Default value: `0.5`. 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. Default value: `False`. 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. Default value: `True`. name: Python `str` name prefixed to Ops created by this class. Default value: `'Triangular'`. Raises: InvalidArgumentError: if `validate_args=True` and one of the following is True: * `low >= high`. * `peak > high`. * `low > peak`. """ parameters = dict(locals()) with tf.name_scope(name) as name: dtype = dtype_util.common_dtype([low, high, peak], tf.float32) self._low = tensor_util.convert_nonref_to_tensor(low, name='low', dtype=dtype) self._high = tensor_util.convert_nonref_to_tensor(high, name='high', dtype=dtype) self._peak = tensor_util.convert_nonref_to_tensor(peak, name='peak', dtype=dtype) super(Triangular, self).__init__(dtype=self._low.dtype, reparameterization_type=reparameterization. FULLY_REPARAMETERIZED, validate_args=validate_args, allow_nan_stats=allow_nan_stats, parameters=parameters, name=name)
def __init__(self, dimension, concentration, input_output_cholesky=False, validate_args=False, allow_nan_stats=True, name='LKJ'): """Construct LKJ distributions. Args: dimension: Python `int`. The dimension of the correlation matrices to sample. concentration: `float` or `double` `Tensor`. The positive concentration parameter of the LKJ distributions. The pdf of a sample matrix `X` is proportional to `det(X) ** (concentration - 1)`. input_output_cholesky: Python `bool`. If `True`, functions whose input or output have the semantics of samples assume inputs are in Cholesky form and return outputs in Cholesky form. In particular, if this flag is `True`, input to `log_prob` is presumed of Cholesky form and output from `sample` is of Cholesky form. Setting this argument to `True` is purely a computational optimization and does not change the underlying distribution. Additionally, validation checks which are only defined on the multiplied-out form are omitted, even if `validate_args` is `True`. Default value: `False` (i.e., input/output does not have Cholesky semantics). 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. 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. name: Python `str` name prefixed to Ops created by this class. Raises: ValueError: If `dimension` is negative. """ if dimension < 0: raise ValueError( 'There are no negative-dimension correlation matrices.') parameters = dict(locals()) self._input_output_cholesky = input_output_cholesky with tf.name_scope(name): dtype = dtype_util.common_dtype([concentration], tf.float32) self._concentration = tensor_util.convert_nonref_to_tensor( concentration, name='concentration', dtype=dtype) self._dimension = dimension super(LKJ, self).__init__( dtype=self._concentration.dtype, validate_args=validate_args, allow_nan_stats=allow_nan_stats, reparameterization_type=reparameterization.NOT_REPARAMETERIZED, parameters=parameters, name=name)