mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-18 13:55:14 +02:00
corrected the predictive variance for Gaussian likelihoods
This commit is contained in:
parent
9d27c920e0
commit
eb82d6a255
4 changed files with 12 additions and 7 deletions
|
|
@ -51,7 +51,7 @@ class Gaussian(likelihood):
|
|||
true_var = (var + self._variance)*self._std**2
|
||||
_5pc = mean + - 2.*np.sqrt(true_var)
|
||||
_95pc = mean + 2.*np.sqrt(true_var)
|
||||
return mean, _5pc, _95pc
|
||||
return mean, true_var, _5pc, _95pc
|
||||
|
||||
def fit_full(self):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -25,11 +25,16 @@ class likelihood:
|
|||
def _get_param_names(self):
|
||||
raise NotImplementedError
|
||||
|
||||
def _set_params(self,x):
|
||||
def _set_params(self, x):
|
||||
raise NotImplementedError
|
||||
|
||||
def fit(self):
|
||||
raise NotImplementedError
|
||||
|
||||
def _gradients(self,partial):
|
||||
def _gradients(self, partial):
|
||||
raise NotImplementedError
|
||||
|
||||
def predictive_values(self, mu, var):
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -48,14 +48,14 @@ class probit(likelihood_function):
|
|||
|
||||
def predictive_values(self,mu,var):
|
||||
"""
|
||||
Compute mean, and conficence interval (percentiles 5 and 95) of the prediction
|
||||
Compute mean, variance and conficence interval (percentiles 5 and 95) of the prediction
|
||||
"""
|
||||
mu = mu.flatten()
|
||||
var = var.flatten()
|
||||
mean = stats.norm.cdf(mu/np.sqrt(1+var))
|
||||
p_025 = np.zeros(mu.shape)
|
||||
p_975 = np.ones(mu.shape)
|
||||
return mean, p_025, p_975
|
||||
return mean, np.nan*var, p_025, p_975 # TODO: better values here (mean is okay)
|
||||
|
||||
class Poisson(likelihood_function):
|
||||
"""
|
||||
|
|
@ -131,4 +131,4 @@ class Poisson(likelihood_function):
|
|||
tmp = stats.poisson.ppf(np.array([.025,.975]),mean)
|
||||
p_025 = tmp[:,0]
|
||||
p_975 = tmp[:,1]
|
||||
return mean,p_025,p_975
|
||||
return mean,np.nan*mean,p_025,p_975 # better variance here TODO
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue