Skip to content

Commit f63ed48

Browse files
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) ```
1 parent 0a9893e commit f63ed48

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

GPy/models/gp_multiout_regression_md.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ def __init__(self, X, Y, indexD, Xr_dim, kernel=None, kernel_row=None, Z=None,
7272
kernel = kern.RBF(X.shape[1])
7373
if kernel_row is None:
7474
kernel_row = kern.RBF(Xr_dim,name='kern_row')
75+
76+
if num_inducing[1] > self.output_dim:
77+
msg = 'Number of inducing points ({}) in latent space must be <= output dim ({})'
78+
raise ValueError(msg.format(num_inducing[1], self.output_dim))
7579

7680
if init=='GP':
7781
from . import SparseGPRegression, BayesianGPLVM

0 commit comments

Comments
 (0)