Adding correlation distance metric in oneDAL primitives#3059
Adding correlation distance metric in oneDAL primitives#3059richardnorth3 merged 38 commits intouxlfoundation:mainfrom
Conversation
|
https://github.com/uxlfoundation/oneDAL/blob/main/cpp/oneapi/dal/backend/primitives/stat/cov.hpp#L34 should help you in calculating the means for each row (column_wise reduction to generate the sum, then calculate the mean using the second function) this will leverage the GPUs capabilities |
| ndview<Float, 2>& out, | ||
| const event_vector& deps = {}) const { | ||
| const std::int64_t n = u.get_dimension(0); | ||
| auto u_sum = ndarray<Float, 1>::empty({ 1 }); |
There was a problem hiding this comment.
Thanks for writing this up @richardnorth3 ! https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.distance.correlation.html should be a good reference for the means necessary. The mean doesn't need to be a single value, but a vector the size of a single sample with each being the mean value for each feature (i.e. for each row). This will then be a vector subtraction. Let me know if I am misunderstanding things about your implementation. Good progress.
There was a problem hiding this comment.
Hey sorry about that, the definition is the mean of the 1d array, so my recommendations have been a little bit wrong.
|
After heavily mediating over numerous drafts and codebase reviews, I ultimately came back to your original advice @icfaust after an epiphany. This version of the correlation distance reuses most of the cosine distance code but calculates the deviations first, passes those values to |
cpp/oneapi/dal/backend/primitives/distance/correlation_distance_dpc.cpp
Outdated
Show resolved
Hide resolved
cpp/oneapi/dal/backend/primitives/distance/correlation_distance_dpc.cpp
Outdated
Show resolved
Hide resolved
|
@Mergifyio rebase |
☑️ Nothing to doDetails
|
Signed-off-by: North Iii <[email protected]>
Signed-off-by: North Iii <[email protected]>
Signed-off-by: North Iii <[email protected]>
Signed-off-by: North Iii <[email protected]>
Signed-off-by: North Iii <[email protected]>
Signed-off-by: North Iii <[email protected]>
Signed-off-by: North Iii <[email protected]>
Signed-off-by: North Iii <[email protected]>
Signed-off-by: North Iii <[email protected]>
Signed-off-by: richard.north.iii <[email protected]>
Signed-off-by: richard.north.iii <[email protected]>
Signed-off-by: richard.north.iii <[email protected]>
4658d8f to
7c877d4
Compare
cpp/oneapi/dal/backend/primitives/distance/correlation_distance_misc.hpp
Show resolved
Hide resolved
cpp/oneapi/dal/backend/primitives/distance/correlation_distance_misc_dpc.cpp
Outdated
Show resolved
Hide resolved
cpp/oneapi/dal/backend/primitives/distance/correlation_distance_misc_dpc.cpp
Outdated
Show resolved
Hide resolved
cpp/oneapi/dal/backend/primitives/distance/correlation_distance_misc_dpc.cpp
Outdated
Show resolved
Hide resolved
cpp/oneapi/dal/backend/primitives/distance/correlation_distance_misc_dpc.cpp
Outdated
Show resolved
Hide resolved
cpp/oneapi/dal/backend/primitives/distance/correlation_distance_misc_dpc.cpp
Show resolved
Hide resolved
cpp/oneapi/dal/backend/primitives/distance/test/correlation_distance_dpc.cpp
Outdated
Show resolved
Hide resolved
Alexandr-Solovev
left a comment
There was a problem hiding this comment.
Overall, it looks good to me! Well done! I have a few minor questions and suggestions for now
|
/intelci: run |
Signed-off-by: richard.north.iii <[email protected]>
cpp/oneapi/dal/backend/primitives/distance/correlation_distance_misc_dpc.cpp
Outdated
Show resolved
Hide resolved
Signed-off-by: richard.north.iii <[email protected]>
|
/intelci: run |
Signed-off-by: richard.north.iii <[email protected]>
|
/intelci: run |
Alexandr-Solovev
left a comment
There was a problem hiding this comment.
The private ci in the commit before apply clang format is green! Well done!
Vika-F
left a comment
There was a problem hiding this comment.
The failure in latest CI is not related to the changes. LGTM.
PR completeness and readability
Testing