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
]]) – If the given shape is, e.g(m, n, k)
, thenm * n * k
samples are drawn (default:None
) Can only be specified whenmean
andstd
are numeric values, else exception will be raised. Default isNone
, where a single value is returned.device (
Optional
[Union
[Device
,NativeDevice
]]) – device on which to create the array. ‘cuda:0’, (default:None
) ‘cuda:1’, ‘cpu’ etc. (Default value = None).dtype (
Optional
[Union
[Dtype
,NativeDtype
]]) – output array data type. Ifdtype
isNone
, the output array data (default:None
) type will be the default floating point data type. DefaultNone
seed (
Optional
[int
]) – A python integer. Used to create a random seed distribution (default:None
)out (
Optional
[Array
]) – optional output array, for writing the result to. It must have a shape (default:None
) that the inputs broadcast to.
- Return type:
- Returns:
ret – Returns an array with the given shape filled with random values sampled from a beta distribution.
- Array.beta(self, alpha, beta, /, *, device=None, dtype=None, seed=None, out=None)#
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 (
Union
[int
,Array
,NativeArray
]) – The first parameter of the beta distribution.beta (
Union
[int
,Array
,NativeArray
]) – The second parameter of the beta distribution.device (
Optional
[Union
[Device
,NativeDevice
]]) – device on which to create the array. (default:None
)dtype (
Optional
[Union
[Dtype
,NativeDtype
]]) – output array data type. Ifdtype
isNone
, the output array data (default:None
) type will be the default data type. DefaultNone
seed (
Optional
[int
]) – A python integer. Used to create a random seed distribution (default:None
)out (
Optional
[Array
]) – optional output array, for writing the result to. It must have a shape (default:None
) 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, /, *, alpha, beta, shape=None, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, device=None, dtype=None, seed=None, out=None)#
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 (
Union
[int
,float
,Container
,Array
,NativeArray
]) – 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
]]) – The shape of the output array. Default isNone
. (default:None
)key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
]]]) – The key-chains to apply or not apply the method to. Default isNone
. (default:None
)to_apply (
bool
) – If True, the method will be applied to key_chains, otherwise key_chains (default:True
) will be skipped. Default isTrue
.prune_unapplied (
bool
) – Whether to prune key_chains for which the function was not applied. (default:False
) Default isFalse
.map_sequences (
bool
) – Whether to also map method to sequences (lists, tuples). (default:False
) Default isFalse
.device (
Optional
[str
]) – The device to place the output array on. Default isNone
. (default:None
)dtype (
Optional
[str
]) – The data type of the output array. Default isNone
. (default:None
)seed (
Optional
[int
]) – A python integer. Used to create a random seed distribution (default:None
)out (
Optional
[Container
]) – optional output container, for writing the result to. It must have a shape (default:None
) that the inputs broadcast to.
- Return type:
Container
- Returns:
ret – A container object, with values drawn from the beta distribution.