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

Fix for issue where curranking would be float, yielding an error at np.bincount in recovery.rcc2d() #7

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jberkh
Copy link

@jberkh jberkh commented Mar 29, 2024

I ran into an issue in pyscenic, where some values for pyscenic.prune.prun2df arguments auc_threshold and nes_threshold, it gave the following error:

File "/home/jberkh/miniconda3/envs/envScenic/lib/python3.10/site-packages/ctxcore/recovery.py", line 80, in rcc2d
    np.bincount(curranking, weights=weights)[:rank_threshold]
TypeError: Cannot cast array data from dtype('float64') to dtype('int64') according to the rule 'safe'

The error arises from the need for an integer matrix as input for np.bincount. Apparently, curranking becomes a float matrix at certain values for auc_threshold and nes_threshold. The explicit cast to int fixes this issue.

NB: I'm unsure if the broader context of the code would necessitate calling np.rint() before casting to int. If so, please edit the PR where necessary.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
…o int
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