Skip to content
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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
Copy link
Collaborator

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.

Title: 'probability-distributions.md'
Copy link
Collaborator

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.

Suggested change
Title: 'probability-distributions.md'
Title: 'Probability Distribution'

Description: 'This entry provides an introduction to probability distributions, their syntax, and an example using SciPy.'
Copy link
Collaborator

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.

Suggested change
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.'

Subjects:
- 'Bash/Shell'
- 'Data Visualization'
- 'Information Technology'
Tags:
- 'Data Structures'
- 'Functions'
- 'Probability'
CatalogContent:
- 'docs/content/scipy/concepts/scipy-stats/terms/probability-distributions/probability-distributions.md'
- 'Python:SciPy'
Comment on lines +13 to +14
Copy link
Collaborator

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.

Suggested change
- 'docs/content/scipy/concepts/scipy-stats/terms/probability-distributions/probability-distributions.md'
- 'Python:SciPy'
- 'learn-data-science'
- 'paths/data-science-foundations'

---

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;.
Copy link
Collaborator

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.

Suggested change
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.


## Syntax
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()
Comment on lines +20 to +26
Copy link
Collaborator

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.

Suggested change
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()


## Example: Normal distribution using SciPy
Copy link
Collaborator

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.

Suggested change
## Example: Normal distribution using SciPy
## Example

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)
Comment on lines +29 to +44
Copy link
Collaborator

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.

Suggested change
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