mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-18 13:55:14 +02:00
Fixed symmetry in checkgrad issue
This commit is contained in:
parent
557d4ea7ea
commit
0c3747dc4d
1 changed files with 6 additions and 1 deletions
|
|
@ -453,7 +453,12 @@ class Model(Parameterized):
|
||||||
|
|
||||||
if not verbose:
|
if not verbose:
|
||||||
# just check the global ratio
|
# just check the global ratio
|
||||||
dx = step * np.sign(np.random.uniform(-1, 1, x.size))
|
|
||||||
|
#choose a random direction to find the linear approximation in
|
||||||
|
if x.size==2:
|
||||||
|
dx = step * np.ones(2) # random direction for 2 parameters can fail dure to symmetry
|
||||||
|
else:
|
||||||
|
dx = step * np.sign(np.random.uniform(-1, 1, x.size))
|
||||||
|
|
||||||
# evaulate around the point x
|
# evaulate around the point x
|
||||||
f1, g1 = self.objective_and_gradients(x + dx)
|
f1, g1 = self.objective_and_gradients(x + dx)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue