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

[Term Entry] Python - NumPy Linear-algebra: .cholesky() #6438

Merged
merged 7 commits into from
Apr 10, 2025

Conversation

mamtawardhani
Copy link
Collaborator

Description

[Term Entry] Python - NumPy Linear-algebra: .cholesky(

Issue Solved

Closes #6417

Type of Change

  • Adding a new 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.

@mamtawardhani mamtawardhani added new entry New entry or entries numpy NumPy entries status: under review Issue or PR is currently being reviewed labels Mar 31, 2025

This example shows how to apply Cholesky decomposition to a covariance matrix calculated from actual data. It demonstrates the usefulness of Cholesky decomposition in statistical analysis by providing information about the correlation structure of the data. The diagonal elements of the Cholesky factor can give insight into the variance contributed by each independent component.

To explore more about NumPy and its role in statistics, consider exploring the [Learn Statistics with NumPy](https://www.codecademy.com/enrolled/courses/intro-statistics-numpy) course at Codecademy.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this line

Copy link
Collaborator

@raditya1117 raditya1117 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great content. Example 1 is sufficient to explain the syntax and working of the function. Example 2 and 3 will be more suitable for an article instead of the term entry. We can remove those in my opinion. @mamtawardhani

@Radhika-okhade
Copy link
Collaborator

We need 2-3 examples per entry. Do you suggest replacing the existing examples with simpler ones, or can we keep these?

@raditya1117
Copy link
Collaborator

raditya1117 commented Apr 7, 2025

In the second example, we can use np.allclose() function along with np.linalg.eigvals() function instead of the manual calculation to show if the input matrix is positive definite (All the eigenvalues of a positive definite matrix are greater than 0). We can give one example where the input matrix is positive definite and another example where the input matrix isn't positive definite to show that the function only processes positive-definite matrices. This will reduce extra information contained in the examples.
Update: As cholesky decomposition is only applied to square (symmetric) matrices, we can even give an example where the functions fails if the input matrix is of shapes like 3x5 or 2x3. @mamtawardhani @Radhika-okhade

@mamtawardhani
Copy link
Collaborator Author

Hey @raditya1117, I've changed examples 2 and 3 based on your suggestions. Could you please check? Thanks! 🙇🏻

@raditya1117
Copy link
Collaborator

Looks good @mamtawardhani.

@Radhika-okhade Radhika-okhade merged commit f05c95a into Codecademy:main Apr 10, 2025
7 checks passed
Copy link

👋 @mamtawardhani
You have contributed to Codecademy Docs, and we would like to know more about you and your experience.
Please take a minute to fill out this four question survey to help us better understand Docs contributions and how we can improve the experience for you and our learners.
Thank you for your help!

🎉 Your contribution(s) can be seen here:

https://www.codecademy.com/resources/docs/python/deque

Please note it may take a little while for changes to become visible.
If you're appearing as anonymous and want to be credited, visit the linked accounts page and ensure that your GitHub account is linked.

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.

[Term Entry] Python - NumPy Linear-algebra: .cholesky()
3 participants