beta#

ivy.beta(a, b, /, *, shape=None, device=None, dtype=None, seed=None, out=None)[source]#

Return an array filled with random values sampled from a beta distribution.

Parameters:
  • a (Union[float, NativeArray, Array]) – Alpha parameter of the beta distribution.

  • b (Union[float, NativeArray, Array]) – Beta parameter of the beta distribution.

  • shape (Optional[Union[Shape, NativeShape]], default: None) – If the given shape is, e.g (m, n, k), then m * n * k samples are drawn Can only be specified when mean and std are numeric values, else exception will be raised. Default is None, where a single value is returned.

  • device (Optional[Union[Device, NativeDevice]], default: None) – device on which to create the array. ‘cuda:0’, ‘cuda:1’, ‘cpu’ etc. (Default value = None).

  • dtype (Optional[Union[Dtype, NativeDtype]], default: None) – output array data type. If dtype is None, the output array data type will be the default floating point data type. Default None

  • seed (Optional[int], default: None) – A python integer. Used to create a random seed distribution

  • out (Optional[Array], default: None) – optional output array, for writing the result to. It must have a shape that the inputs broadcast to.

Return type:

Array

Returns:

ret – Returns an array with the given shape filled with random values sampled from a beta distribution.

Array.beta(self, beta, /, *, shape=None, device=None, dtype=None, seed=None, out=None)[source]#

ivy.Array instance method variant of ivy.beta. This method simply wraps the function, and so the docstring for ivy.beta also applies to this method with minimal changes.

Parameters:
  • self (Array) – Input Array.

  • alpha – The first parameter of the beta distribution.

  • beta (Union[int, Array, NativeArray]) – The second parameter of the beta distribution.

  • device (Optional[Union[Device, NativeDevice]], default: None) – device on which to create the array.

  • dtype (Optional[Union[Dtype, NativeDtype]], default: None) – output array data type. If dtype is None, the output array data type will be the default data type. Default None

  • seed (Optional[int], default: None) – A python integer. Used to create a random seed distribution

  • out (Optional[Array], default: None) – optional output array, for writing the result to. It must have a shape that the inputs broadcast to.

Return type:

Array

Returns:

ret – Drawn samples from the parameterized beta distribution with the shape of the array.

Container.beta(self, beta, /, *, shape=None, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, device=None, dtype=None, seed=None, out=None)[source]#

ivy.Container instance method variant of ivy.beta. This method simply wraps the function, and so the docstring for ivy.beta also applies to this method with minimal changes.

Parameters:
  • self (Container) – Input container. Should have a numeric data type.

  • alpha – The alpha parameter of the distribution.

  • beta (Union[int, float, Container, Array, NativeArray]) – The beta parameter of the distribution.

  • shape (Optional[Union[Shape, NativeShape, Container]], default: None) – The shape of the output array. Default is None.

  • key_chains (Optional[Union[List[str], Dict[str, str], Container]], default: None) – The key-chains to apply or not apply the method to. Default is None.

  • to_apply (Union[bool, Container], default: True) – If True, the method will be applied to key_chains, otherwise key_chains will be skipped. Default is True.

  • prune_unapplied (Union[bool, Container], default: False) – Whether to prune key_chains for which the function was not applied. Default is False.

  • map_sequences (Union[bool, Container], default: False) – Whether to also map method to sequences (lists, tuples). Default is False.

  • device (Optional[Union[str, Container]], default: None) – The device to place the output array on. Default is None.

  • dtype (Optional[Union[str, Container]], default: None) – The data type of the output array. Default is None.

  • seed (Optional[Union[int, Container]], default: None) – A python integer. Used to create a random seed distribution

  • out (Optional[Container], default: None) – optional output container, for writing the result to. It must have a shape that the inputs broadcast to.

Return type:

Container

Returns:

ret – A container object, with values drawn from the beta distribution.