Skip to content

Commit a70456f

Browse files
authored
[Edit] Numpy: Random: .beta() (#6993)
* Removed inline LaTex and reconfigured formatting * Update content/numpy/concepts/random-module/terms/beta/beta.md ---------
1 parent b281e3c commit a70456f

File tree

1 file changed

+11
-7
lines changed
  • content/numpy/concepts/random-module/terms/beta

1 file changed

+11
-7
lines changed

content/numpy/concepts/random-module/terms/beta/beta.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,15 @@ In the `random` module of NumPy, the **`.beta()`** method generates random sampl
1818

1919
The Beta distribution has the probability function:
2020

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+
```
2224

2325
Where `B` represents the beta function:
2426

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+
```
2630

2731
## Syntax
2832

@@ -32,8 +36,8 @@ numpy.random.beta(a, b, size=None)
3236

3337
**Parameters:**
3438

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.
3741
- `size` (Optional): Defines the shape of the output array. If not provided, the behavior depends on whether `a` and `b` are scalars or arrays.
3842

3943
**Return value:**
@@ -45,7 +49,7 @@ In NumPy, the `.beta()` function returns a randomly drawn sample or an array of
4549

4650
## Example: Generating Random Values from a Beta Distribution
4751

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:
4953

5054
```py
5155
import numpy as np
@@ -62,13 +66,13 @@ A possible output of this code can be:
6266
[0.14092969 0.52861406 0.15658351 0.545189 0.47077243]
6367
```
6468

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.
6670

6771
> **Note:** The output may vary with each execution because the values are randomly generated.
6872
6973
## Codebyte Example
7074

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:
7276

7377
```codebyte/python
7478
import numpy as np

0 commit comments

Comments
 (0)