-
Notifications
You must be signed in to change notification settings - Fork 222
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
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 |
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.
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 do
|
Signed-off-by: North Iii <richard.north.iii@intel.com>
Signed-off-by: North Iii <richard.north.iii@intel.com>
Signed-off-by: North Iii <richard.north.iii@intel.com>
Signed-off-by: North Iii <richard.north.iii@intel.com>
Signed-off-by: North Iii <richard.north.iii@intel.com>
Signed-off-by: North Iii <richard.north.iii@intel.com>
Signed-off-by: North Iii <richard.north.iii@intel.com>
Signed-off-by: North Iii <richard.north.iii@intel.com>
Signed-off-by: North Iii <richard.north.iii@intel.com>
Signed-off-by: richard.north.iii <rnorthii@smtp.jf.intel.com>
Signed-off-by: richard.north.iii <rnorthii@smtp.jf.intel.com>
Signed-off-by: richard.north.iii <rnorthii@smtp.jf.intel.com>
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
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.
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 <rnorthii@smtp.jf.intel.com>
cpp/oneapi/dal/backend/primitives/distance/correlation_distance_misc_dpc.cpp
Outdated
Show resolved
Hide resolved
Signed-off-by: richard.north.iii <rnorthii@smtp.jf.intel.com>
/intelci: run |
Signed-off-by: richard.north.iii <rnorthii@smtp.jf.intel.com>
/intelci: run |
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.
The private ci in the commit before apply clang format is green! Well done!
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.
The failure in latest CI is not related to the changes. LGTM.
PR completeness and readability
Testing