==Description of the problem==
After applying the fix, we get the correct gradient at the beginning of the
optimisation. However, as soon as the parameters change, the gradients
become wrong again.
==How do I reproduce it==
Create SequentialGP with covariance function parameters x0. Compute the
gradient at point x=x0 (works fine) and the move away from x0. The gradient
becomes more and more wrong as x gets further away from x0.
I have put a test in TestSequentialGP to reproduce the error.
==What is the cause of the problem (optional)==
It seems to be a numerical issue with the way the gradient is computed. I
found another way of computing the gradient which gives the correct value
even for x!=x0 (see fix below).
==Directions for fix (optional)==
In the computation of the gradient, use:
W = W-( eye(sizeActiveSet) + (KB * (C + outer_product(Alpha, Alpha))));
mat U = backslash(KB_new,KB);
for(int i = 0; i < covFunc.getNumberParameters(); i++)
{
covFunc.getParameterPartialDerivative(partialDeriv, i, ActiveSet);
mat V = backslash(KB_new,partialDeriv*U).transpose();
grads(i) = elem_mult_sum(W, V) / 2.0;
}
It seems including the partial derivative *inside* the computation of the
inverse is a lot more robust than computing the inverse and then
multiplying it by the derivative inside the loop (as done before). This way
is also more computationally demanding, though. We might need to look for
more efficient ways to compute this (maybe using Cholesky decompositions).
Original issue reported on code.google.com by remi.bar...@gmail.com on 29 Jun 2009 at 5:15
Original issue reported on code.google.com by
remi.bar...@gmail.com
on 29 Jun 2009 at 5:15