Closed
Description
Two requests:
(1) Please replace this line:
https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/gaussian_process/gpr.py#L329
from this
yvar -= np.einsum("ki,kj,ij->k", K_trans, K_trans, K_inv)
to this
sum1 = np.dot(K_trans,K_inv).T
yvar -= np.einsum("ki,ik->k", K_trans, sum1)
For an input data set of size 800x1, the time difference is 12.7 seconds to 0.2 seconds. I have validated that the result is the same up to 1e-12 or smaller.
(2) Please cache the result of the K_inv computation. It depends only on the result of training, and can be very costly for repeated calls to the class.