-
Notifications
You must be signed in to change notification settings - Fork 221
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
Adding correlation distance metric in oneDAL primitives #3059
base: main
Are you sure you want to change the base?
Adding correlation distance metric in oneDAL primitives #3059
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 |
Signed-off-by: North Iii <[email protected]>
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey sorry about that, the definition is the mean of the 1d array, so my recommendations have been a little bit wrong.
Signed-off-by: North Iii <[email protected]>
Signed-off-by: North Iii <[email protected]>
Signed-off-by: North Iii <[email protected]>
…rth3/oneDAL into dev/correlation-metric
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 |
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: North Iii <[email protected]>
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
…e_dpc.cpp Co-authored-by: Victoriya Fedotova <[email protected]>
…e_dpc.cpp Co-authored-by: Victoriya Fedotova <[email protected]>
Signed-off-by: richard.north.iii <[email protected]>
Signed-off-by: North Iii <[email protected]>
Signed-off-by: richard.north.iii <[email protected]>
Signed-off-by: North Iii <[email protected]>
PR completeness and readability
Testing
Performance