Skip to content

Commit

Permalink
Add error message for excess inducing points (#746)
Browse files Browse the repository at this point in the history
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) 
```
  • Loading branch information
nsfinkelstein committed Apr 17, 2022
1 parent 0a9893e commit f63ed48
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions GPy/models/gp_multiout_regression_md.py
Expand Up @@ -72,6 +72,10 @@ def __init__(self, X, Y, indexD, Xr_dim, kernel=None, kernel_row=None, Z=None,
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
Expand Down

0 comments on commit f63ed48

Please sign in to comment.