Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions GPy/inference/latent_function_inference/fitc.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ def inference(self, kern, X, Z, likelihood, Y, mean_function=None, Y_metadata=No


# Compute dL_dKmm
vvT_P = tdot(v.reshape(-1,1)) + P
vvT_P = tdot(v) + P
dL_dK = 0.5*(Kmmi - vvT_P)
KiU = np.dot(Kmmi, U.T)
dL_dK += np.dot(KiU*dL_dR, KiU.T)

# Compute dL_dU
vY = np.dot(v.reshape(-1,1),Y.T)
vY = np.dot(v, Y.T)
dL_dU = vY - np.dot(vvT_P, U.T)
dL_dU *= beta_star
dL_dU -= 2.*KiU*dL_dR
Expand Down
13 changes: 12 additions & 1 deletion GPy/testing/fitc.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,18 @@ def setUp(self):
self.Y1D = np.sin(self.X1D) + np.random.randn(N, 1) * 0.05

######################################
# # 2 dimensional example
# # 2 dimensional example with 1 dimensional output

# sample inputs and outputs
self.X2D = np.random.uniform(-3., 3., (N, 2))
self.Y2D = np.sin(self.X2D[:, 0:1]) * np.sin(self.X2D[:, 1:2]) + np.random.randn(N, 1) * 0.05

######################################
# # 2 dimensional example with 2 dimensional output

# sample inputs and outputs
self.Y2D2D = np.sin(self.X2D) + np.random.randn(N, 2) * 0.05

def test_fitc_1d(self):
m = GPy.models.SparseGPRegression(self.X1D, self.Y1D)
m.inference_method=GPy.inference.latent_function_inference.FITC()
Expand All @@ -32,3 +38,8 @@ def test_fitc_2d(self):
m.inference_method=GPy.inference.latent_function_inference.FITC()
self.assertTrue(m.checkgrad())

def test_fitc_2d2d(self):
m = GPy.models.SparseGPRegression(self.X2D, self.Y2D2D)
m.inference_method=GPy.inference.latent_function_inference.FITC()
self.assertTrue(m.checkgrad())