@@ -198,16 +198,18 @@ def _build_marginal_likelihood(self, X, noise):
198
198
chol = cholesky (stabilize (cov ))
199
199
return mu , chol
200
200
201
- def marginal_likelihood (self , name , n_points , X , y , noise , is_observed = True ):
201
+ def marginal_likelihood (self , name , X , y , noise , n_points = None , is_observed = True ):
202
202
if not isinstance (noise , Covariance ):
203
203
noise = pm .gp .cov .WhiteNoise (noise )
204
204
mu , chol = self ._build_marginal_likelihood (X , noise )
205
205
self .X = X
206
206
self .y = y
207
207
self .noise = noise
208
208
if is_observed :
209
- return pm .MvNormal ( name , mu = mu , chol = chol , observed = y )
209
+ return pm .MvNormal . dist ( mu = mu , chol = chol ). logp ( y )
210
210
else :
211
+ if n_points is None :
212
+ raise ValueError ("When `y` is not observed, `n_points` arg is required" )
211
213
return pm .MvNormal (name , mu = mu , chol = chol , size = n_points )
212
214
213
215
def _build_conditional (self , Xnew , X , y , noise , pred_noise ):
@@ -295,7 +297,7 @@ def marginal_likelihood(self, name, n_points, X, Xu, y, sigma, is_observed=True)
295
297
self .y = y
296
298
self .sigma = sigma
297
299
logp = lambda y : self ._build_marginal_likelihood_logp (X , Xu , y , sigma )
298
- if is_observed :
300
+ if is_observed : # same thing ith n_points here?? check
299
301
return pm .DensityDist (name , logp , observed = y )
300
302
else :
301
303
return pm .DensityDist (name , logp , size = n_points ) # need size? if not, dont need size arg
0 commit comments