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

Unable to bind scipy.sparse.csr_matrix.log1p #18

Open
npow opened this issue Jan 13, 2023 · 2 comments
Open

Unable to bind scipy.sparse.csr_matrix.log1p #18

npow opened this issue Jan 13, 2023 · 2 comments

Comments

@npow
Copy link

npow commented Jan 13, 2023

Hi, I encountered a strange issue trying to bind scipy.sparse.csr_matrix.log1p. It's saying ModuleNotFoundError: No module named 'scipy.sparse.csr_matrix', but it does exist?

from pipelinex import HatchDict
import yaml
from pprint import pprint  # pretty-print for clearer look

import scipy.sparse
assert scipy.sparse.csr_matrix.log1p

params_yaml = """
fn:
  =: scipy.sparse.csr_matrix.log1p
"""
parameters = yaml.safe_load(params_yaml)
fn = HatchDict(parameters).get("fn")
print(fn)
@Minyus
Copy link
Owner

Minyus commented Jan 14, 2023

Hi @npow ,

scipy.sparse.csr_matrix.log1p does not work because from scipy.sparse.csr_matrix import log1p does not work.

Instead, numpy.log1p should work because from numpy import log1p works.
Can this be a workaround?

@npow
Copy link
Author

npow commented Jan 14, 2023

numpy.log1p doesn't support sparse matrices. I've made a workaround by defining my own function which then calls scipy.sparse.csr_matrix.log1p but was wondering if there's a better way.

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

No branches or pull requests

2 participants