From f63ed48b0d4bf043868a0a1729d28003c13fe263 Mon Sep 17 00:00:00 2001 From: Noam Finkelstein <2919482+nsfinkelstein@users.noreply.github.com> Date: Sun, 17 Apr 2022 12:28:05 -0400 Subject: [PATCH] Add error message for excess inducing points (#746) The number of inducing points in the latent space defaults to 10, which creates an error if there are fewer than 10 conditions (i.e. output dimension is less than 10). Currently this error shows up somewhat opaquely. This fix makes the error explicit, which may save time for future developers. The current error shown is: ``` ~/code/anaconda/lib/python3.6/site-packages/GPy/inference/latent_function_inference/vardtc_svi_multiout_miss.py in inference_d(self, d, beta, Y, indexD, grad_dict, mid_res, uncertain_inputs_r, uncertain_inputs_c, Mr, Mc) 82 LcInvPsi1_cT = dtrtrs(Lc, psi1_c.T)[0] 83 LrInvPsi1_rT = dtrtrs(Lr, psi1_r.T)[0] ---> 84 85 tr_LrInvPsi2_rLrInvT_LrInvSrLrInvT = (LrInvPsi2_rLrInvT*LrInvSrLrInvT).sum() 86 tr_LcInvPsi2_cLcInvT_LcInvScLcInvT = (LcInvPsi2_cLcInvT*LcInvScLcInvT).sum() ValueError: operands could not be broadcast together with shapes (5,5) (6,6) ``` --- GPy/models/gp_multiout_regression_md.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/GPy/models/gp_multiout_regression_md.py b/GPy/models/gp_multiout_regression_md.py index 292f525d..917fa4b7 100644 --- a/GPy/models/gp_multiout_regression_md.py +++ b/GPy/models/gp_multiout_regression_md.py @@ -72,6 +72,10 @@ class GPMultioutRegressionMD(SparseGP): kernel = kern.RBF(X.shape[1]) if kernel_row is None: kernel_row = kern.RBF(Xr_dim,name='kern_row') + + if num_inducing[1] > self.output_dim: + msg = 'Number of inducing points ({}) in latent space must be <= output dim ({})' + raise ValueError(msg.format(num_inducing[1], self.output_dim)) if init=='GP': from . import SparseGPRegression, BayesianGPLVM