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 the different behavior of the division operator in python3.6 #10

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

Conversation

azad96
Copy link

@azad96 azad96 commented Feb 14, 2024

get_class_ind() function is supposed to return class indices, but '/' operator does float division in python3.6 while it does integer divison in python2.7. As a result, we can get class indices such as 9.75, which creates a bug in the code. For example, we have the below line at line 171.

sq_dists[self.get_class_ind(seed_cluster) == self.cluster_classes] = np.inf

When the left-hand side of == does not return a whole number in python3.6, none of the values in self.cluster_classes are equal to that value. This behaviour is fixed by changing '/' to '//' since '//' does integer division in both python versions.

…oat in python3.6, which makes the return values of the function different
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.

None yet

1 participant