-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
52 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
...s/data-distributions/terms/exponential-distribution/exponential-distribution.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
--- | ||
Title: 'Exponential Distribution' | ||
Description: 'The exponential distribution is a probability distribution often used to model the time between events in a Poisson process.' | ||
Subjects: | ||
- 'Data Science' | ||
- 'Statistics' | ||
Tags: | ||
- 'Data Distributions' | ||
- 'Exponential' | ||
CatalogContent: | ||
- 'learn-data-science' | ||
- 'paths/data-science' | ||
--- | ||
|
||
The **exponential distribution** models the time between independent events that occur at a fixed average rate. It is frequently used in reliability analysis, queuing theory, and survival analysis. The distribution is defined by a single parameter, the rate λ which determines how quickly events occur. | ||
|
||
The exponential distribution formula is given by: | ||
|
||
$$f(x|λ) = λ e^{-λ x}$$ | ||
|
||
- `λ`: The rate parameter that represents the number of events per unit time. | ||
- `x`: A random variable that represents the time between events. | ||
|
||
## Example | ||
|
||
The example below demonstrates how to generate random samples from an exponential distribution using NumPy and visualize the results with a histogram using Matplotlib: | ||
|
||
```python | ||
import numpy as np | ||
import matplotlib.pyplot as plt | ||
|
||
# Set the rate parameter (lambda) | ||
rate = 1.5 # Events per unit time | ||
|
||
# Generate 1,000 random samples from the exponential distribution | ||
data = np.random.exponential(scale=1/rate, size=1000) | ||
|
||
# Plot the histogram of the generated data | ||
plt.hist(data, bins=30, density=True, alpha=0.6, color='teal', edgecolor='black') | ||
plt.title(f"Exponential Distribution (rate = {rate})") | ||
plt.xlabel("Time Between Events") | ||
plt.ylabel("Density") | ||
plt.show() | ||
``` | ||
|
||
The above code produces the following output: | ||
|
||
 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -393,6 +393,7 @@ Visibility | |
VR | ||
Vue | ||
Web3 | ||
Exponential | ||
WebRTC | ||
Weight & Bias | ||
While | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.