@@ -18,11 +18,15 @@ In the `random` module of NumPy, the **`.beta()`** method generates random sampl
18
18
19
19
The Beta distribution has the probability function:
20
20
21
- $$ f\left(x; \alpha, \beta \right) = \int \frac{1}{B\left(\alpha, \beta \right)} x^{\alpha -1} \left(1-x \right)^{\beta -1} $$
21
+ ``` tex
22
+ f\left(x; \alpha, \beta \right) = \frac{1}{B\left(\alpha, \beta \right)} x^{\alpha -1} \left(1-x \right)^{\beta -1}
23
+ ```
22
24
23
25
Where ` B ` represents the beta function:
24
26
25
- $$ B(\alpha, \beta) = \int_0^1 t^{\alpha -1} (1-t)^{\beta -1 } dt $$
27
+ ``` tex
28
+ B(\alpha, \beta) = \int_0^1 t^{\alpha -1} (1-t)^{\beta -1 } dt
29
+ ```
26
30
27
31
## Syntax
28
32
@@ -32,8 +36,8 @@ numpy.random.beta(a, b, size=None)
32
36
33
37
** Parameters:**
34
38
35
- - ` a ` (float or array_like of floats): The alpha ($\alpha$) shape parameter. This must be a positive value.
36
- - ` b ` (float or array_like of floats): The beta ($\beta$) shape parameter. This must also be positive.
39
+ - ` a ` (float or array_like of floats): The alpha shape parameter. This must be a positive value.
40
+ - ` b ` (float or array_like of floats): The beta shape parameter. This must also be positive.
37
41
- ` size ` (Optional): Defines the shape of the output array. If not provided, the behavior depends on whether ` a ` and ` b ` are scalars or arrays.
38
42
39
43
** Return value:**
@@ -45,7 +49,7 @@ In NumPy, the `.beta()` function returns a randomly drawn sample or an array of
45
49
46
50
## Example: Generating Random Values from a Beta Distribution
47
51
48
- The example below shows how to generate random values from a beta distribution configured with an $\ alpha$ and $\ beta$ value:
52
+ The example below shows how to generate random values from a beta distribution configured with an alpha and beta value:
49
53
50
54
``` py
51
55
import numpy as np
@@ -62,13 +66,13 @@ A possible output of this code can be:
62
66
[0.14092969 0.52861406 0.15658351 0.545189 0.47077243]
63
67
```
64
68
65
- This code randomly draws 5 values from a beta distribution with a $\ alpha$ of 3 and a $\ beta$ of 4.
69
+ This code randomly draws 5 values from a beta distribution with an alpha of 3 and a beta of 4.
66
70
67
71
> ** Note:** The output may vary with each execution because the values are randomly generated.
68
72
69
73
## Codebyte Example
70
74
71
- In this codebyte example, we sample 5 values from a beta distribution with an $\ alpha$ or (` a ` ) of 2 and a $\ beta$ or (` b ` ) of 5:
75
+ In this codebyte example, we sample 5 values from a beta distribution with an alpha or (` a ` ) of 2 and a beta or (` b ` ) of 5:
72
76
73
77
``` codebyte/python
74
78
import numpy as np
0 commit comments