mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-11 04:52:37 +02:00
link_function class renamed as LinkFunction
This commit is contained in:
parent
a2bc6ec1e6
commit
2da309aab8
3 changed files with 9 additions and 10 deletions
|
|
@ -21,7 +21,7 @@ class LikelihoodFunction(object):
|
||||||
if link == self._analytical:
|
if link == self._analytical:
|
||||||
self.moments_match = self._moments_match_analytical
|
self.moments_match = self._moments_match_analytical
|
||||||
else:
|
else:
|
||||||
assert isinstance(link,link_functions.link_function)
|
assert isinstance(link,link_functions.LinkFunction)
|
||||||
self.link = link
|
self.link = link
|
||||||
self.moments_match = self._moments_match_numerical
|
self.moments_match = self._moments_match_numerical
|
||||||
|
|
||||||
|
|
@ -79,7 +79,7 @@ class Binomial(LikelihoodFunction):
|
||||||
$$
|
$$
|
||||||
"""
|
"""
|
||||||
def __init__(self,link=None):
|
def __init__(self,link=None):
|
||||||
self._analytical = link_functions.probit
|
self._analytical = link_functions.Probit
|
||||||
if not link:
|
if not link:
|
||||||
link = self._analytical
|
link = self._analytical
|
||||||
super(Binomial, self).__init__(link)
|
super(Binomial, self).__init__(link)
|
||||||
|
|
@ -146,7 +146,7 @@ class Poisson(LikelihoodFunction):
|
||||||
def __init__(self,link=None):
|
def __init__(self,link=None):
|
||||||
self._analytical = None
|
self._analytical = None
|
||||||
if not link:
|
if not link:
|
||||||
link = link_functions.log()
|
link = link_functions.Log()
|
||||||
super(Poisson, self).__init__(link)
|
super(Poisson, self).__init__(link)
|
||||||
|
|
||||||
def _distribution(self,gp,obs):
|
def _distribution(self,gp,obs):
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ import pylab as pb
|
||||||
from ..util.plot import gpplot
|
from ..util.plot import gpplot
|
||||||
from ..util.univariate_Gaussian import std_norm_pdf,std_norm_cdf
|
from ..util.univariate_Gaussian import std_norm_pdf,std_norm_cdf
|
||||||
|
|
||||||
class link_function(object):
|
class LinkFunction(object):
|
||||||
"""
|
"""
|
||||||
Link function class for doing non-Gaussian likelihoods approximation
|
Link function class for doing non-Gaussian likelihoods approximation
|
||||||
|
|
||||||
|
|
@ -19,7 +19,7 @@ class link_function(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class identity(link_function):
|
class Identity(LinkFunction):
|
||||||
def transf(self,mu):
|
def transf(self,mu):
|
||||||
return mu
|
return mu
|
||||||
|
|
||||||
|
|
@ -29,7 +29,7 @@ class identity(link_function):
|
||||||
def log_inv_transf(self,f):
|
def log_inv_transf(self,f):
|
||||||
return np.log(f)
|
return np.log(f)
|
||||||
|
|
||||||
class log(link_function):
|
class Log(LinkFunction):
|
||||||
|
|
||||||
def transf(self,mu):
|
def transf(self,mu):
|
||||||
return np.log(mu)
|
return np.log(mu)
|
||||||
|
|
@ -40,7 +40,7 @@ class log(link_function):
|
||||||
def log_inv_transf(self,f):
|
def log_inv_transf(self,f):
|
||||||
return f
|
return f
|
||||||
|
|
||||||
class log_ex_1(link_function):
|
class Log_ex_1(LinkFunction):
|
||||||
def transf(self,mu):
|
def transf(self,mu):
|
||||||
return np.log(np.exp(mu) - 1)
|
return np.log(np.exp(mu) - 1)
|
||||||
|
|
||||||
|
|
@ -50,11 +50,10 @@ class log_ex_1(link_function):
|
||||||
def log_inv_tranf(self,f):
|
def log_inv_tranf(self,f):
|
||||||
return np.log(np.log(np.exp(f)+1))
|
return np.log(np.log(np.exp(f)+1))
|
||||||
|
|
||||||
class probit(link_function):
|
class Probit(LinkFunction):
|
||||||
|
|
||||||
def inv_transf(self,f):
|
def inv_transf(self,f):
|
||||||
return std_norm_cdf(f)
|
return std_norm_cdf(f)
|
||||||
|
|
||||||
def log_inv_transf(self,f):
|
def log_inv_transf(self,f):
|
||||||
return np.log(std_norm_cdf(f))
|
return np.log(std_norm_cdf(f))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ class FITCClassification(FITC):
|
||||||
|
|
||||||
:param X: input observations
|
:param X: input observations
|
||||||
:param Y: observed values
|
:param Y: observed values
|
||||||
:param likelihood: a GPy likelihood, defaults to Binomial with probit link_function
|
:param likelihood: a GPy likelihood, defaults to Binomial with probit link function
|
||||||
:param kernel: a GPy kernel, defaults to rbf+white
|
:param kernel: a GPy kernel, defaults to rbf+white
|
||||||
:param normalize_X: whether to normalize the input data before computing (predictions will be in original scales)
|
:param normalize_X: whether to normalize the input data before computing (predictions will be in original scales)
|
||||||
:type normalize_X: False|True
|
:type normalize_X: False|True
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue