Skip to content

Commit

Permalink
flatten dimensions when calculating distance b/w 2
Browse files Browse the repository at this point in the history
  • Loading branch information
MridulS committed Sep 26, 2019
1 parent 9563bcf commit 24dea3e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion HARK/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ def distanceMetric(thing_A, thing_B):
if thing_A.shape == thing_B.shape:
distance = np.max(abs(thing_A - thing_B))
else:
distance = np.max(abs(thing_A.shape - thing_B.shape))
# Flatten arrays so there are in the same dimensions
distance = np.max(abs(thing_A.flatten().shape[0] - thing_B.flatten().shape[0]))
# If none of the above cases, but the objects are of the same class, call
# the distance method of one on the other
elif thing_A.__class__.__name__ == thing_B.__class__.__name__:
Expand Down

0 comments on commit 24dea3e

Please sign in to comment.