-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added terms and probability-distributions folders and file #5914
base: main
Are you sure you want to change the base?
Added terms and probability-distributions folders and file #5914
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @SaraVegaKeene, thanks for contributing to docs, please go through the comments and do the required changes. Let me know if you need any help or have any questions.
Also, please sign the CLA agreement or else we won't be able to merge this PR.
- 'docs/content/scipy/concepts/scipy-stats/terms/probability-distributions/probability-distributions.md' | ||
- 'Python:SciPy' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are not valid catalog content resources, please refer to catalog-content.md for reference.
- 'docs/content/scipy/concepts/scipy-stats/terms/probability-distributions/probability-distributions.md' | |
- 'Python:SciPy' | |
- 'learn-data-science' | |
- 'paths/data-science-foundations' |
@@ -0,0 +1,44 @@ | |||
--- | |||
Title: 'probability-distributions.md' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The title should be the same as the file name but not with the extension. It should also be in the title case.
Title: 'probability-distributions.md' | |
Title: 'Probability Distribution' |
@@ -0,0 +1,44 @@ | |||
--- | |||
Title: 'probability-distributions.md' | |||
Description: 'This entry provides an introduction to probability distributions, their syntax, and an example using SciPy.' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The description should be the definition of the concept being explained.
Description: 'This entry provides an introduction to probability distributions, their syntax, and an example using SciPy.' | |
Description: 'Probability Distribution is a function that describes the likelihood of different outcomes for a random variable.' |
- 'Python:SciPy' | ||
--- | ||
|
||
The element of surprise. **Probability distributions** describe how the structure of random variables are allocated. In the context of SciPy, the scipy.stats module provides various functions for working with different probability distributions that deliver consistent information such as Cumulative Distribution Functions (CDF), Probability Density Functions (PDF), and other statistical metrics.They convey the probabilities of various outcomes, and are fundamental to statistics and data analysis;. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please format the text according to the style-guide.md.
The element of surprise. **Probability distributions** describe how the structure of random variables are allocated. In the context of SciPy, the scipy.stats module provides various functions for working with different probability distributions that deliver consistent information such as Cumulative Distribution Functions (CDF), Probability Density Functions (PDF), and other statistical metrics.They convey the probabilities of various outcomes, and are fundamental to statistics and data analysis;. | |
**Probability distribution** describes how the values of random variables are distributed. In the context of [SciPy](https://www.codecademy.com/resources/docs/scipy), the `scipy.stats` module provides various functions for working with different probability distributions, offering consistent information such as **Cumulative Distribution Functions (CDF)**, **Probability Density Functions (PDF)**, and other statistical metrics. These distributions convey the probabilities of various outcomes and are fundamental to statistics and data analysis. |
@@ -0,0 +1,44 @@ | |||
--- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The file name should be singular - probability-distribution.md
. Please fix that.
from scipy.stats import distribution_name | ||
rv = distribution_name(parameters) | ||
cdf_value = rv.cdf(x) | ||
pdf_value = rv.pdf(x) | ||
pmf_value = rv.pmf(x) | ||
mean_value = rv.mean() | ||
variance_value = rv.var() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be wrapped in code syntax. Add suitable code comments for better understanding.
from scipy.stats import distribution_name | |
rv = distribution_name(parameters) | |
cdf_value = rv.cdf(x) | |
pdf_value = rv.pdf(x) | |
pmf_value = rv.pmf(x) | |
mean_value = rv.mean() | |
variance_value = rv.var() | |
```pseudo | |
from scipy.stats import distribution_name | |
# Create a random variable object for the distribution | |
rv = distribution_name(parameters) | |
# Compute the CDF (Cumulative Distribution Function) at x | |
cdf_value = rv.cdf(x) | |
# Compute the PDF (Probability Density Function) at x (for continuous distributions) | |
pdf_value = rv.pdf(x) | |
# Compute the PMF (Probability Mass Function) at x (for discrete distributions) | |
pmf_value = rv.pmf(x) | |
# Compute the mean of the distribution | |
mean_value = rv.mean() | |
# Compute the variance of the distribution | |
variance_value = rv.var() | |
from scipy.stats import norm | ||
|
||
rv = norm(loc=0, scale=1) | ||
|
||
cdf_value = rv.cdf(1) | ||
|
||
pdf_value = rv.pdf(1) | ||
|
||
mean_value = rv.mean() | ||
|
||
variance_value = rv.var() | ||
|
||
print("CDF at x=1:", cdf_value) | ||
print("PDF at x=1:", pdf_value) | ||
print("Mean of the distribution:", mean_value) | ||
print("Variance of the distribution:", variance_value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to above comment, add code comments and wrap in code syntax. Also include output and brief explanation for the code.
from scipy.stats import norm | |
rv = norm(loc=0, scale=1) | |
cdf_value = rv.cdf(1) | |
pdf_value = rv.pdf(1) | |
mean_value = rv.mean() | |
variance_value = rv.var() | |
print("CDF at x=1:", cdf_value) | |
print("PDF at x=1:", pdf_value) | |
print("Mean of the distribution:", mean_value) | |
print("Variance of the distribution:", variance_value) | |
```py | |
from scipy.stats import norm | |
# Create a normal distribution with mean 0 and standard deviation 1 | |
rv = norm(loc=0, scale=1) | |
# Compute the CDF (Cumulative Distribution Function) at x = 1 | |
cdf_value = rv.cdf(1) # The probability that a value from the distribution is <= 1 | |
# Compute the PDF (Probability Density Function) at x = 1 | |
pdf_value = rv.pdf(1) # The likelihood (height of the curve) at x = 1 | |
# Compute the mean of the distribution | |
mean_value = rv.mean() # The expected value (center) of the distribution | |
# Compute the variance of the distribution | |
variance_value = rv.var() # The measure of spread of the distribution | |
# Output the results | |
print("CDF at x=1:", cdf_value) | |
print("PDF at x=1:", pdf_value) | |
print("Mean of the distribution:", mean_value) | |
print("Variance of the distribution:", variance_value) |
The output of the above code will be as follows:
CDF at x=1: 0.8413447460685429
PDF at x=1: 0.24197072451914337
Mean of the distribution: 0.0
Variance of the distribution: 1.0
mean_value = rv.mean() | ||
variance_value = rv.var() | ||
|
||
## Example: Normal distribution using SciPy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should just be Example
as heading.
## Example: Normal distribution using SciPy | |
## Example |
Description
Issue Solved
Type of Change
Checklist
main
branch.Issues Solved
section.