I am trying to fit multiple observations to a single Gaussian Process.
I try to fit the data of two observations (Y) like this:
import numpy as np
from sklearn.gaussian_process import GaussianProcessRegressor
from sklearn.gaussian_process.kernels import RBF, ConstantKernel as C
# Example data
# Input data X
X = np.array([[1.0], [2.0], [3.0], [4.0], [5.0]])
# Output data Y
Y = np.array([[1.5, 2.5], [2.5, 3.5], [3.5, 4.5], [4.5, 5.5], [5.5, 6.5]])
kernel = C(1.0, (1e-4, 1e1)) * RBF(1.0, (1e-4, 1e1))
gp = GaussianProcessRegressor(kernel=kernel, n_restarts_optimizer=10)
# Fitting the model
gp.fit(X, Y)
mean_prediction, cov_prediction = gp.predict(X, return_cov=True)
I am getting two array of mean_prediction and two cov_prediction matrices. But I want a single mean and covariance matrix of same dimension as the observations corresponding to single fitted GP. How can I implement that?