Skip to content

Commit

Permalink
Cosine distance: Fix clipping
Browse files Browse the repository at this point in the history
  • Loading branch information
janezd committed Mar 13, 2019
1 parent d962655 commit a0309b8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Orange/distance/distance.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ def prepare_data(x):
data1 = prepare_data(x1)
data2 = data1 if x2 is None else prepare_data(x2)
dist = safe_sparse_dot(data1, data2.T)
np.clip(dist, 0, 1, out=dist)
np.clip(dist, -1, 1, out=dist)
if x2 is None:
diag = np.diag_indices_from(dist)
dist[diag] = np.where(np.isnan(dist[diag]), np.nan, 1.0)
Expand Down

0 comments on commit a0309b8

Please sign in to comment.