-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat: added kernel density estimation to score matching. #258
Conversation
coreax/score_matching.py
Outdated
|
||
return children, aux_data | ||
|
||
def match(self, x: ArrayLike) -> Callable: |
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.
If x
is not used, should we put x: ArrayLike | None = None
? Then we don't need to call match
with anything; particularly in test_score_matching.py
.
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.
Agreed and added
tests/unit/test_score_matching.py
Outdated
|
||
# Extract the score function (this is not really learned from the data, more | ||
# defined within the object) | ||
learned_score = kernel_density_matcher.match(samples) |
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.
If comment here is followed, we shouldn't need the match
argument.
Repeat for all other calls to match in TestKernelDensityMatching
.
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.
Updated to not input anything (since it's unused)
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.
All looks fine functionally. I suggest making the x
argument to match
optional in KernelDensityMatching
, then remove the arguments accordingly in test_score_matching.py
. See comments for detail.
Refs: 257
PR Type
Description
When converting kernel.py to OOP, we removed the functionality to (easily) estimate a score function via kernel density estimation. This has been added back into score_matching.py to provide an alternative to the neural network approach.
How Has This Been Tested?
Added test class
TestKernelDensityMatching
with:Test A: test_univariate_gaussian_score
Test B: test_multivariate_gaussian_score
Test C: test_univariate_gmm_score
Test D: test_multivariate_gmm_score
Does this PR introduce a breaking change?
No
Checklist before requesting a review