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

Clark/allow duplicated inputs #1

Open
wants to merge 3 commits into
base: mneilly/cythonize
Choose a base branch
from

Conversation

clark-hive
Copy link

@clark-hive clark-hive commented Sep 9, 2022

Currently if all rows of X are the same the proposal distribution q becomes an array of nan's and calling random_state.choice throws ValueError: probabilities contain NaN.

Here's a minimal reproducible example:

import kmc2  
import numpy as np

k=16
x= np.random.rand(8)
X=np.atleast_2d(x).repeat(repeats=10,axis=0)
print(kmc2.kmc2(X, k).astype(np.float32))

I ran into this on the third pytest case in the bolt repo.

This was mentioned later on in the thread where you originally made the fix to the bolt repo: dblalock/bolt#4 (comment) and recently raised again: dblalock/bolt#37.

Or would a better way be to check at the top for the matrix only having 1 unique row and returning that row K times?

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