I added some python code to check that the derivative matches (more or less) the slope of the values on a unary function. Currently this is just applied to harmonic, which is not extremely useful (but I do use it on other not-yet submitted unary functions).
Daniel Russel wrote: > I added some python code to check that the derivative matches (more or > less) the slope of the values on a unary function. Currently this is > just applied to harmonic, which is not extremely useful (but I do use it > on other not-yet submitted unary functions).
The patch seems to touch a lot of stuff that's entirely unrelated to that. But I don't know why you want to check the derivatives anyway - I already added code to check derivatives for *all* the unary functions in r473.
Ben
Reading the patch, I still don't see how to invoke general derivative test code for a unary function (and it doesn't appear to happen automatically either). So I don't understand your comment.
On Mar 26, 2008, at 10:18 PM, Ben Webb wrote:
> Daniel Russel wrote: >> I added some python code to check that the derivative matches (more >> or >> less) the slope of the values on a unary function. Currently this is >> just applied to harmonic, which is not extremely useful (but I do >> use it >> on other not-yet submitted unary functions). > > The patch seems to touch a lot of stuff that's entirely unrelated to > that. But I don't know why you want to check the derivatives anyway > - I > already added code to check derivatives for *all* the unary > functions in > r473. > > Ben > -- > ben@salilab.org http://salilab.org/~ben/ > "It is a capital mistake to theorize before one has data." > - Sir Arthur Conan Doyle > _______________________________________________ > IMP-dev mailing list > IMP-dev@salilab.org > https://salilab.org/mailman/listinfo/imp-dev
Daniel Russel wrote: > Reading the patch, I still don't see how to invoke general derivative > test code for a unary function (and it doesn't appear to happen > automatically either). So I don't understand your comment.
The existing checks are for analytic derivatives. If you also want to check numerical derivatives, that would certainly make sense. But to do this properly requires something like dfridr from Numerical Recipes. I have not done this so far because the NR license prohibits us from including this code directly in IMP.
Ben
On Mar 27, 2008, at 12:43 PM, Ben Webb wrote:
> The existing checks are for analytic derivatives. If you also want to > check numerical derivatives, that would certainly make sense. I assume you mean the existing checks are "analytic checks of derivatives" and "check derivatives numerically", right? How the derivative is evaluated internally doesn't really matter for how we do the checking.
> But to do > this properly requires something like dfridr from Numerical Recipes. I > have not done this so far because the NR license prohibits us from > including this code directly in IMP. The dumb way of checking the derivatives numerically that I submitted does well enough for the functions we have now. If we need something better later we can improve it.
In general, we don't really care that the values of the derivatives are exactly correct as they are just used to approximate the shape of the function, just that they are more or less right.
Daniel Russel wrote: > On Mar 27, 2008, at 12:43 PM, Ben Webb wrote: >> The existing checks are for analytic derivatives. If you also want to >> check numerical derivatives, that would certainly make sense. > I assume you mean the existing checks are "analytic checks of > derivatives" and "check derivatives numerically", right? How the > derivative is evaluated internally doesn't really matter for how we do > the checking.
The Python code defines the function and its derivative analytically. Of course it has no bearing on how the C++ code defines the function. Yes, we could write Python code to calculate numerical derivatives, but this seems unnecessary to me because I know that the derivative of x^3 is 3x^2 and so can just write that in the Python code. That's what's done in the existing patch.
Ben
> Yes, > we could write Python code to calculate numerical derivatives, but > this > seems unnecessary to me because I know that the derivative of x^3 is > 3x^2 and so can just write that in the Python code. That's what's done > in the existing patch. It is really nice have function-independent test code as it ensures that the test code isn't just a duplication of the C++ code containing the same mistakes (or vice versa). Unless the code is really different it doesn't really test anything. For Cosine it is fine as it is trivial, for WLC it was not fine as there were some issues with missing constants.
participants (2)
-
Ben Webb
-
Daniel Russel