Skip to content

Commit 9a0ba8c

Browse files
committed
Merge pull request scikit-learn#5049 from amueller/gp_reshape_fixes
[MRG + 1] fix shape of thetaL, thetaU, theta0 in gp
2 parents 598665e + c3b56ac commit 9a0ba8c

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

sklearn/gaussian_process/gaussian_process.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -718,17 +718,16 @@ def minus_reduced_likelihood_function(log10t):
718718
else:
719719
# Generate a random starting point log10-uniformly
720720
# distributed between bounds
721-
log10theta0 = np.log10(self.thetaL) \
722-
+ self.random_state.rand(self.theta0.size).reshape(
723-
self.theta0.shape) * np.log10(self.thetaU
724-
/ self.thetaL)
721+
log10theta0 = (np.log10(self.thetaL)
722+
+ self.random_state.rand(*self.theta0.shape)
723+
* np.log10(self.thetaU / self.thetaL))
725724
theta0 = 10. ** log10theta0
726725

727726
# Run Cobyla
728727
try:
729728
log10_optimal_theta = \
730729
optimize.fmin_cobyla(minus_reduced_likelihood_function,
731-
np.log10(theta0), constraints,
730+
np.log10(theta0).ravel(), constraints,
732731
iprint=0)
733732
except ValueError as ve:
734733
print("Optimization failed. Try increasing the ``nugget``")

0 commit comments

Comments
 (0)