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

Remove np.matrix dependency #213

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

JohnMMa
Copy link

@JohnMMa JohnMMa commented Jul 25, 2023

As most of us may know, numpy is slowly deprecating the np.matrix class. However, the package still has one dependency on this class in report_matrix.ipynb, and scikit-learn is also in the process of doing it (see scikit-learn/scikit-learn#20165). This PR causes the pca.fit_transform's input to switch from np.matrix (the output of csr_matrix.todense()) to np.ndarray (the output of csr_matrix.toarray()`)

However, it must be noted that pca.fit_transform() may have slightly different results depending on its input being np.matrix or np.ndarray, see scikit-learn/scikit-learn#18941. I guess the difference is small enough to matter, but I guess you may think about it a bit.

This is my first PR in the past 5 years, so bear with me.

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

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

Successfully merging this pull request may close these issues.

1 participant