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

Conversation

SaraVegaKeene
Copy link

Description

Issue Solved

Type of Change

  • Adding a new entry Term for Existing Concept Entry

Checklist

  • All writings are my own.
  • My entry follows the Codecademy Docs style guide.
  • My changes generate no new warnings.
  • I have performed a self-review of my own writing and code.
  • I have checked my entry and corrected any misspellings.
  • I have made corresponding changes to the documentation if needed.
  • I have confirmed my changes are not being pushed from my forked main branch.
  • I have confirmed that I'm pushing from a new branch named after the changes I'm making.
  • I have linked any issues that are relevant to this PR in the Issues Solved section.

@CLAassistant
Copy link

CLAassistant commented Jan 3, 2025

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ PragatiVerma18
❌ SaraVKeene
You have signed the CLA already but the status is still pending? Let us recheck it.

@PragatiVerma18 PragatiVerma18 self-assigned this Jan 8, 2025
Copy link
Collaborator

@PragatiVerma18 PragatiVerma18 left a 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.

Comment on lines +13 to +14
- 'docs/content/scipy/concepts/scipy-stats/terms/probability-distributions/probability-distributions.md'
- 'Python:SciPy'
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'

@@ -0,0 +1,44 @@
---
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'

@@ -0,0 +1,44 @@
---
Title: 'probability-distributions.md'
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.'

- '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;.
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.

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

Comment on lines +20 to +26
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()
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()

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

mean_value = rv.mean()
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants