Skip to content

Commit

Permalink
Update dissim.py
Browse files Browse the repository at this point in the history
  • Loading branch information
AGMortimer committed Jun 10, 2019
1 parent fd89c66 commit dca3d65
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions kmodes/util/dissim.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ def jaccard_binary_dissim(a, b, **_):

if np.isnan(a).any() or np.isnan(b).any():
raise ValueError("Missing values detected in numerical columns.")
elif (a < 0).any() or (a > 1).any():
raise ValueError("Non-binary values detected in numerical columns.")
elif (b < 0).any() or (b > 1).any():
raise ValueError("Non-binary values detected in numerical columns.")

i = np.sum((a == 1) & (b == 1), axis=1)
j = np.sum((a == 1) | (b == 1), axis=1)
Expand Down

0 comments on commit dca3d65

Please sign in to comment.