-
Notifications
You must be signed in to change notification settings - Fork 32
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
Series of tests for AD #114
Conversation
One major issue is currently #113. And I have no idea how to solve it |
To be honest, I was planning to address this at the same time as #88. In my opinion the correct way to do this is to incorporate differentiability tests in with the standard test suite, as opposed to having a collection of tests in a separate location. No objection to this going in for now to get us in roughly the right place, but I don't think it's the correct solution long-term. |
So you propose to integrate each all the AD test separately for each type of kernel in their test file? |
Yup.
We want to test everything in the public-facing API for every kernel that we write tests for.
👍 |
…FiniteDifferences.jl
@willtebbutt Would you be satisfied by these tests? I would lay them out all over the tests but I prefer to check with you first :P |
It's definitely a reasonable starting point. We shouldn't really be testing gradients, rather we should be testing pushforwards / pullbacks. Unfortunately ForwardDiff and ReverseDiff don't expose these in their public APIs, so I'll need to do some digging after NeurIPS. I would propose you merge this, because it's a definitely improvement over what we currently have, and we revisit after NeurIPS when refactoring the test suite. edit: I'm not sure why coverage has reduced, but it would be good to understand why before merging. |
Coverage has reduced because of some additional adjoints and functions that were needed for AD. Once I put all the tests in place it should actually go up :) |
So I spread all the tests to the BaseKernels, Kernels and Transforms and when tests were failing I simply left out the AD in question and left a @test_broken with a comment. I listed all the failures in #116 |
I was also unable to find the proper adjoint for the pairwise function with the |
I'm surprised about these test failures - it has to be related to the PR in some way, otherwise they wouldn't have passed all the time on master? Maybe try to set a seed (if we haven't fixed one yet)? |
Yeah, would definitely be nice to resolve this before merging. |
I will try to figure out the issue with FBM, but I thought this was maybe irrelevant to this PR ? |
Can I merge this? |
Ah maybe before I can put all dependencies for the test directly in a |
All tests are passing, if there is no objections I am going to merge |
@theogf do you know why coverage has dropped? |
@willtebbutt, yes, I needed to add some functionalities (mostly for Zygote) but sometimes it was not enough to make all tests pass (yet I left them there as they will be needed in the future). Right now tests are either all correct and removed. I want to tackle all of the different AD problems (all mentioned in #116 ) but would prefer to go one PR at a time, ss there are definitely a lot of issues. |
I started to re-adapt the tests given the new structure and make them look a bit nicer.
Right now the idea is to compare the results (when possible) with FiniteDifferences.jl
The tests are quite generic and changeable.
The idea is to test differentiability given the inputs for all ADs and to test the differentiability given the kernel parameters only given Zygote. (other kernels would require more complex solutions)The tests functions for AD are contained in
test/utils_AD.jl
.A first function needs to be called with FiniteDifferences.jl to check that it runs without errors (eliminate one source of error when comparing)
A second function will compare a AD (so far implemented for Zygote, ForwardDiff and ReverseDiff) with a kernelfunction which may take arguments. The test setup for a kernel would look like this:
where
k = kernelfunction(args)
and args is a vectorAlternatively for no args :
Are tested :
kappa
forSimpleKernel
k(x, y)
givenk
,x
ANDy
kernelmatrix(A, B)
for bothRowVecs
andColVecs
, also givenA
,B
andk
(I usesum
to get a scalar on it)Are added to make more tests pass:
_map
fromBase.map
for avoidZygote
bug withmap
onAbstractVector
DotProduct
andSinus