-
Notifications
You must be signed in to change notification settings - Fork 3
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
Find pdist
with known shape
#71
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -160,12 +160,9 @@ def pdist(X, metric="euclidean", **kwargs): | |
|
||
result = cdist(X, X, metric, **kwargs) | ||
|
||
result = dask.array.triu(result, 1) | ||
|
||
indices = _compat._indices(result.shape, chunks=result.chunks) | ||
mask = (indices[1] > indices[0]) | ||
|
||
result = _compat._ravel(result)[_compat._ravel(mask)] | ||
result = dask.array.concatenate([ | ||
result[i, i + 1:] for i in range(0, len(result) - 1) | ||
]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Am a little concerned about this performance-wise for large numbers of points. Reason being this makes the graph balloon with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That said, it seems to do ok given reasonable chunk sizes when playing around with it locally. So perhaps this is not worth worrying about until use cases that have issues present themselves. |
||
|
||
return result | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missed using
irange
here. Fixing in PR ( #80 ).