-
Notifications
You must be signed in to change notification settings - Fork 94
Replace kernel computation in kgof with hyppo's compute_kern #322
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
Comments
Hey! Newbie contributor here with some questions about putting this feature request to rest. Excited to start contributing to some open source 😄 .
Would love to be assigned on this and see what you guys think about the analytical approach. If that is something that would be desired, I can start working on a draft PR. |
Lgtm
…________________________________
From: tjoab ***@***.***>
Sent: Friday, April 4, 2025 8:59:18 PM
To: neurodata/hyppo ***@***.***>
Cc: darsh-patel ***@***.***>; Author ***@***.***>
Subject: Re: [neurodata/hyppo] Replace kernel computation in kgof with hyppo's compute_kern (Issue #322)
Hey! Newbie contributor here with some questions about putting this feature request to rest. Excited to start contributing to some open source 😄 .
1. From my deep dive, the crux of the problem here is the ArrayBox object. It seems that this is just what autograd.numpy uses within it gradient tracking and there no way around it. If you unpack its value, to then feed into compute_kern(), you actually break the computational tree which is why autograd.numpy yells at us 😢. This is where my next question comes.
2. Can we assume that kernel.py will only implement kernels with nice analytic gradients? If so, then I think the best call would to just scrap autograd.numpy completely and just manually compute the gradients. This keeps everything as an 'ndarray' and should be compatible with compute_kern() and sklearn functions. The only issue is if we expect to implement kernels that do not have nice analytical derivatives, this is not the best idea.
Would love to be added as a contributor on this and see what you guys think about the analytical approach. If that is something that would be desired, I can start working a draft PR.
—
Reply to this email directly, view it on GitHub<#322 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AQ2GAPTNG3WBHTXM5CZYGXL2X4TGNAVCNFSM6AAAAAB2P4SNCKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDONZZHE4TEOJQHA>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
[tjoab]tjoab left a comment (neurodata/hyppo#322)<#322 (comment)>
Hey! Newbie contributor here with some questions about putting this feature request to rest. Excited to start contributing to some open source 😄 .
1. From my deep dive, the crux of the problem here is the ArrayBox object. It seems that this is just what autograd.numpy uses within it gradient tracking and there no way around it. If you unpack its value, to then feed into compute_kern(), you actually break the computational tree which is why autograd.numpy yells at us 😢. This is where my next question comes.
2. Can we assume that kernel.py will only implement kernels with nice analytic gradients? If so, then I think the best call would to just scrap autograd.numpy completely and just manually compute the gradients. This keeps everything as an 'ndarray' and should be compatible with compute_kern() and sklearn functions. The only issue is if we expect to implement kernels that do not have nice analytical derivatives, this is not the best idea.
Would love to be added as a contributor on this and see what you guys think about the analytical approach. If that is something that would be desired, I can start working a draft PR.
—
Reply to this email directly, view it on GitHub<#322 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AQ2GAPTNG3WBHTXM5CZYGXL2X4TGNAVCNFSM6AAAAAB2P4SNCKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDONZZHE4TEOJQHA>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
@tjoab Thankk you for your comment! I like 2 |
Is your feature request related to a problem? Please describe.
Currently, the kernel goodness-of-fit library
kgof
has its own unique implementation of a kernel evaluation due to a unique data structure returned byautograd.numpy
gradient calculations. ThisArrayBox
data structure does not share properties withnumpy
arrays and therefore must be handled separately and cannot be fed intocompute_kern
.Describe the solution you'd like
Ideally, a new implementation would rip and replace kernel.py by removing its kernel evaluation functions and reducing the corresponding dependencies on
autograd.numpy
to do so. Should be a quick fix if handling of anArrayBox
can be improved or a better gradient calculation implementation is discovered.Describe alternatives you've considered
There has already been an attempt to integrate
compute_kern
by replacing theeval
functions inkernel.py
with instances ofcompute_kern
, but this raises an error in which values in anArrayBox
cannot be reached.Additional context (e.g. screenshots)
The text was updated successfully, but these errors were encountered: