def __init__(self,
                 first,
                 second,
                 sigmoidal,
                 sigmoidal_indicator,
                 location: float = 0.,
                 slope: float = 0.5,
                 width=1.,
                 name='change_window_shifted_sides_base',
                 fixed_slope=False):
        _newkerns = [kern.copy() for kern in (first, second)]
        super(ChangeWindowShiftedSidesBase, self).__init__(_newkerns, name)
        self.first = first
        self.second = second

        self._fixed_slope = fixed_slope  # Note: here to be used by subclasses, and changing it from the outside does not link the parameter
        if self._fixed_slope: self.slope = slope
        else:
            self.slope = Param('slope', np.array(slope), Logexp())
            self.link_parameter(self.slope)

        self.sigmoidal = sigmoidal(1, False, 1., location, slope)
        self.sigmoidal_reverse = sigmoidal(1, True, 1., location, slope)
        self.sigmoidal_indicator = sigmoidal_indicator(1, False, 1., location,
                                                       slope, width)
        # self.shift = _Gk.Bias(1)
        self.location = Param('location', np.array(location))
        self.width = Param('width', np.array(width), Logexp())
        # self.shift_variance = Param('shift_variance', self.shift.variance.values, Logexp())
        self.shift_variance = Param('shift_variance', np.array(0), Logexp())
        self.link_parameters(self.location, self.width, self.shift_variance)
Ejemplo n.º 2
0
    def __init__(self,
                 input_dim: int,
                 variance: float = 1.,
                 period: float = 2. * np.pi,
                 lengthscale: float = 2. * np.pi,
                 active_dims: int = None,
                 name: str = 'pure_std_periodic') -> None:
        super(PureStdPeriodicKernel, self).__init__(input_dim, active_dims,
                                                    name)

        self.name = name

        if period is not None:
            period = np.asarray(period)
            assert period.size == input_dim, "bad number of periods"
        else:
            period = 2. * np.pi * np.ones(input_dim)
        if lengthscale is not None:
            lengthscale = np.asarray(lengthscale)
            assert lengthscale.size == input_dim, "bad number of lengthscales"
        else:
            lengthscale = 2. * np.pi * np.ones(input_dim)

        self.variance = Param('variance', variance, Logexp())
        assert self.variance.size == 1, "Variance size must be one"
        self.period = Param('period', period, Logexp())
        self.lengthscale = Param('lengthscale', lengthscale, Logexp())

        self.link_parameters(self.variance, self.period, self.lengthscale)
Ejemplo n.º 3
0
    def __init__(self, input_dim, variance, lengthscale, period, n_freq, lower,
                 upper, active_dims, name):
        """
        :type input_dim: int
        :param variance: the variance of the Matern kernel
        :type variance: float
        :param lengthscale: the lengthscale of the Matern kernel
        :type lengthscale: np.ndarray of size (input_dim,)
        :param period: the period
        :type period: float
        :param n_freq: the number of frequencies considered for the periodic subspace
        :type n_freq: int
        :rtype: kernel object
        """

        assert input_dim == 1, "Periodic kernels are only defined for input_dim=1"
        super(Periodic, self).__init__(input_dim, active_dims, name)
        self.input_dim = input_dim
        self.lower, self.upper = lower, upper
        self.n_freq = n_freq
        self.n_basis = 2 * n_freq
        self.variance = Param('variance', np.float64(variance), Logexp())
        self.lengthscale = Param('lengthscale', np.float64(lengthscale),
                                 Logexp())
        self.period = Param('period', np.float64(period), Logexp())
        self.link_parameters(self.variance, self.lengthscale, self.period)
Ejemplo n.º 4
0
    def __init__(self,
                 gap_decay=1.0,
                 match_decay=2.0,
                 order_coefs=[1.0],
                 alphabet=[],
                 maxlen=0,
                 active_dims=None,
                 normalize=True,
                 batch_size=1000):
        super(StringKernel, self).__init__(1, active_dims, 'sk')
        self._name = "sk"
        self.gap_decay = Param('Gap_decay', gap_decay, Logexp())
        self.match_decay = Param('Match_decay', match_decay, Logexp())
        self.order_coefs = Param('Order_coefs', order_coefs, Logexp())
        self.link_parameters(self.gap_decay, self.match_decay,
                             self.order_coefs)

        self.alphabet = alphabet
        self.maxlen = maxlen
        self.normalize = normalize

        self.kernel = NPStringKernel(_gap_decay=gap_decay,
                                     _match_decay=match_decay,
                                     _order_coefs=list(order_coefs),
                                     alphabet=self.alphabet,
                                     maxlen=maxlen,
                                     normalize=normalize)
Ejemplo n.º 5
0
 def __init__(self, _lambda=1, _sigma=1, normalize=True, active_dims=None):
     super(SubsetTreeKernel, self).__init__(1, active_dims, 'sstk')
     self._lambda = Param('Lambda', _lambda,Logexp())
     self._sigma = Param('Sigma', _sigma,Logexp())
     self.link_parameters(self._lambda, self._sigma)
     self.normalize = normalize
     self.kernel = wrapper_raw_SubsetTreeKernel(_lambda, _sigma, normalize)
Ejemplo n.º 6
0
    def __init__(self,
                 input_dim,
                 input_space_dim=None,
                 active_dims=None,
                 kernel=None,
                 name='shapeintegral',
                 Nperunit=100,
                 lengthscale=[1.0],
                 variance=1.0):
        """
        NOTE: Added input_space_dim as the number of columns in X isn't the dimensionality of the space. I.e. for pentagons there
        will be 10 columns in X, while only 2 dimensions of input space.
        
        The lengthscale, variance, etc are ideally set by specifying the kernel we'll use
        
        input_dim = number of actual columns in data
        input_space_dim = number of dimensions in the domain
        active_dims = potential list of dimensions we'll use
        kernel = latent function kernel
        Nperunit = resolution of approximation
        
        The last column of X should specify if it's the latent function or the integral that the Y refers to.
        if it's the latent function then we just use the first d-columns, and the rest can be NaN, e.g.
        X                               Y
        0,0,1,0,0,1,0,1,1,0,1,1,0     2
        1,1,nananananananananan,1     3
        is a 1x1 square with an integral of 2, and a single point in the [1,1] corner of the square with a value of 3.
        
        """
        super(ShapeIntegral, self).__init__(input_dim, active_dims, name)

        assert (
            (kernel is not None) or (input_space_dim is not None)
        ), "Need either the input space dimensionality defining or the latent kernel defining (to infer input space)"
        if kernel is None:
            kernel = RBF(input_space_dim)
        else:
            input_space_dim = kernel.input_dim
        assert kernel.input_dim == input_space_dim, "Latent kernel (dim=%d) should have same input dimensionality as specified in input_space_dim (dim=%d)" % (
            kernel.input_dim, input_space_dim)

        #assert len(kern.lengthscale)==input_space_dim, "Lengthscale of length %d, but input space has %d dimensions" % (len(lengthscale),input_space_dim)

        #self.lengthscale = Param('lengthscale', kernel.lengthscale, Logexp()) #Logexp - transforms to allow positive only values...
        #self.variance = Param('variance', kernel.variance, Logexp()) #and here.
        #self.link_parameters(self.variance, self.lengthscale) #this just takes a list of parameters we need to optimise.

        self.kernel = kernel
        self.Nperunit = Nperunit
        self.input_space_dim = input_space_dim
        self.cached_points = {
        }  #this is important, not only is it a speed up - we also get the same points for each shape, which makes our covariances more stable

        self.lengthscale = Param(
            'lengthscale', lengthscale,
            Logexp())  #Logexp - transforms to allow positive only values...
        self.variance = Param('variance', variance, Logexp())  #and here.
        self.link_parameters(
            self.variance, self.lengthscale
        )  #this just takes a list of parameters we need to optimise.
Ejemplo n.º 7
0
    def __init__(self,
                 input_dim,
                 variances=1.0,
                 lengthscale=1.0,
                 ARD=False,
                 active_dims=None,
                 lengthscalefun=None,
                 name='nonstatRBF'):
        super(NonstationaryRBF, self).__init__(input_dim, active_dims, name)

        if lengthscale is None:
            lengthscale = np.ones(1)
        else:
            lengthscale = np.asarray(lengthscale)

        if lengthscalefun is None:
            lengthscalefun = lambda x: lengthscale

        self.lengthscalefun = lengthscalefun
        self.lengthscale = Param(
            'lengthscale', lengthscale,
            Logexp())  #Logexp - transforms to allow positive only values...
        self.variances = Param('variances', variances, Logexp())  #and here.
        self.link_parameters(
            self.variances, self.lengthscale
        )  #this just takes a list of parameters we need to optimise.
 def __init__(self,
              input_dim,
              variance_adjustment,
              variance=1.,
              lengthscale=None,
              rescale_variance=1.,
              ARD=False,
              active_dims=None,
              name='rbf',
              useGPU=False,
              inv_l=False):
     super(CausalRBF, self).__init__(input_dim,
                                     variance,
                                     lengthscale,
                                     ARD,
                                     active_dims,
                                     name,
                                     useGPU=useGPU)
     if self.useGPU:
         self.psicomp = PSICOMP_RBF_GPU()
     else:
         self.psicomp = PSICOMP_RBF()
     self.use_invLengthscale = inv_l
     if inv_l:
         self.unlink_parameter(self.lengthscale)
         self.inv_l = Param('inv_lengthscale', 1. / self.lengthscale**2,
                            Logexp())
         self.link_parameter(self.inv_l)
     self.variance_adjustment = variance_adjustment
     self.rescale_variance = Param('rescale_variance', rescale_variance,
                                   Logexp())
Ejemplo n.º 9
0
 def __init__(self,
              input_dim,
              variance=1.,
              lengthscale=None,
              ARD=False,
              active_dims=None,
              name='se'):
     super(SE, self).__init__(input_dim, active_dims, name)
     self.ARD = ARD
     if not ARD:
         if lengthscale is None:
             lengthscale = np.ones(1)
         else:
             lengthscale = np.asarray(lengthscale)
             assert lengthscale.size == 1, "Only 1 lengthscale needed for non-ARD kernel"
     else:
         if lengthscale is not None:
             lengthscale = np.asarray(lengthscale)
             assert lengthscale.size in [1, input_dim
                                         ], "Bad number of lengthscales"
             if lengthscale.size != input_dim:
                 lengthscale = np.ones(input_dim) * lengthscale
         else:
             lengthscale = np.ones(self.input_dim)
     self.lengthscale = Param('lengthscale', lengthscale, Logexp())
     self.variance = Param('variance', variance, Logexp())
     assert self.variance.size == 1
     self.link_parameters(self.variance, self.lengthscale)
Ejemplo n.º 10
0
    def __init__(self,
                 input_dim=2,
                 output_dim=1,
                 rank=1,
                 W=None,
                 lengthscale=None,
                 decay=None,
                 active_dims=None,
                 name='eq_ode1'):
        assert input_dim == 2, "only defined for 1 input dims"
        super(EQ_ODE1, self).__init__(input_dim=input_dim,
                                      active_dims=active_dims,
                                      name=name)

        self.rank = rank
        self.output_dim = output_dim

        if lengthscale is None:
            lengthscale = .5 + np.random.rand(self.rank)
        else:
            lengthscale = np.asarray(lengthscale)
            assert lengthscale.size in [1, self.rank
                                        ], "Bad number of lengthscales"
            if lengthscale.size != self.rank:
                lengthscale = np.ones(self.rank) * lengthscale

        if W is None:
            W = .5 * np.random.randn(self.output_dim, self.rank) / np.sqrt(
                self.rank)
        else:
            assert W.shape == (self.output_dim, self.rank)

        if decay is None:
            decay = np.ones(self.output_dim)
        else:
            decay = np.asarray(decay)
            assert decay.size in [1, self.output_dim], "Bad number of decay"
            if decay.size != self.output_dim:
                decay = np.ones(self.output_dim) * decay


#        if kappa is None:
#            self.kappa = np.ones(self.output_dim)
#        else:
#            kappa = np.asarray(kappa)
#            assert kappa.size in [1, self.output_dim], "Bad number of kappa"
#            if decay.size != self.output_dim:
#                decay = np.ones(self.output_dim)*kappa

#self.kappa = Param('kappa', kappa, Logexp())
#self.delay = Param('delay', delay, Logexp())
#self.is_normalized = True
#self.is_stationary = False
#self.gaussian_initial = False

        self.lengthscale = Param('lengthscale', lengthscale, Logexp())
        self.decay = Param('decay', decay, Logexp())
        self.W = Param('W', W)
        self.link_parameters(self.lengthscale, self.decay, self.W)
Ejemplo n.º 11
0
    def __init__(self, input_dim, variance=1., scale=1., bias=1., order=3., active_dims=None, name='poly'):
        super(Poly, self).__init__(input_dim, active_dims, name)
        self.variance = Param('variance', variance, Logexp())
        self.scale = Param('scale', scale, Logexp())
        self.bias = Param('bias', bias, Logexp())

        self.link_parameters(self.variance, self.scale, self.bias)
        assert order >= 1, 'The order of the polynomial has to be at least 1.'
        self.order=order
Ejemplo n.º 12
0
 def __init__(self,
              input_dim,
              variance=1.,
              lengthscale=1.,
              active_dims=None):
     super(OUMV, self).__init__(input_dim, active_dims, 'OUMV')
     assert input_dim == 1  #, "For this kernel we assume input_dim=1"
     self.variance = Param('variance', variance, Logexp())
     self.lengthscale = Param('lengthscale', lengthscale, Logexp())
     self.link_parameters(self.variance, self.lengthscale)
Ejemplo n.º 13
0
    def __init__(self, input_dim, variances=None, lengthscale=None, ARD=False, active_dims=None, name='integral'):
        super(Integral, self).__init__(input_dim, active_dims, name)

        if lengthscale is None:
            lengthscale = np.ones(1)
        else:
            lengthscale = np.asarray(lengthscale)

        self.lengthscale = Param('lengthscale', lengthscale, Logexp()) #Logexp - transforms to allow positive only values...
        self.variances = Param('variances', variances, Logexp()) #and here.
        self.link_parameters(self.variances, self.lengthscale) #this just takes a list of parameters we need to optimise.
Ejemplo n.º 14
0
 def __init__(self,
              inv_lengthscale=1,
              period=1,
              name='std_periodic',
              active_dims=None):
     super().__init__(name=name, active_dims=active_dims)
     self.inv_lengthscale = Param('inv_lengthscale', inv_lengthscale,
                                  Logexp())
     self.link_parameter(self.inv_lengthscale)
     self.period = Param('period', period, Logexp())
     self.link_parameter(self.period)
Ejemplo n.º 15
0
 def __init__(self,
              input_dim,
              timescale_H=2.,
              timescale_F=1.,
              sigma_a=1.,
              active_dims=None):
     super(OrsteinUF, self).__init__(input_dim, active_dims, 'OUF')
     assert input_dim == 1  #, "For this kernel we assume input_dim=1"
     self.timescale_H = Param('timescale_H', timescale_H, Logexp())
     self.timescale_F = Param('timescale_F', timescale_F, Logexp())
     self.sigma_a = Param('sigma_a', sigma_a, Logexp())
     self.link_parameters(self.timescale_H, self.timescale_F, self.sigma_a)
Ejemplo n.º 16
0
    def __init__(self,
                 input_dim,
                 variance=None,
                 lengthscale=None,
                 active_dims=None,
                 name='pjkrbf'):
        super(PjkRbf, self).__init__(input_dim, active_dims, name)

        self.lengthscale = Param('lengthscale', lengthscale, Logexp())
        self.variance = Param('variance', variance, Logexp())
        assert self.variance.size == 1
        assert self.lengthscale.size == 1
        self.link_parameters(self.variance, self.lengthscale)
Ejemplo n.º 17
0
    def __init__(self, gp_link=None, deg_free=5, sigma2=2):
        if gp_link is None:
            gp_link = link_functions.Identity()

        super(StudentT, self).__init__(gp_link, name='Student_T')
        # sigma2 is not a noise parameter, it is a squared scale.
        self.sigma2 = Param('t_scale2', float(sigma2), Logexp())
        self.v = Param('deg_free', float(deg_free), Logexp())
        self.link_parameter(self.sigma2)
        self.link_parameter(self.v)
        #self.v.constrain_fixed()

        self.log_concave = False
Ejemplo n.º 18
0
    def __init__(self,
                 input_dim,
                 variance=1.,
                 period=None,
                 lengthscale=None,
                 ARD1=False,
                 ARD2=False,
                 active_dims=None,
                 name='std_periodic',
                 useGPU=False):
        super(StdPeriodic, self).__init__(input_dim,
                                          active_dims,
                                          name,
                                          useGPU=useGPU)
        self.ARD1 = ARD1  # correspond to periods
        self.ARD2 = ARD2  # correspond to lengthscales

        self.name = name

        if self.ARD1 == False:
            if period is not None:
                period = np.asarray(period)
                assert period.size == 1, "Only one period needed for non-ARD kernel"
            else:
                period = np.ones(1)
        else:
            if period is not None:
                period = np.asarray(period)
                assert period.size == input_dim, "bad number of periods"
            else:
                period = np.ones(input_dim)

        if self.ARD2 == False:
            if lengthscale is not None:
                lengthscale = np.asarray(lengthscale)
                assert lengthscale.size == 1, "Only one lengthscale needed for non-ARD kernel"
            else:
                lengthscale = np.ones(1)
        else:
            if lengthscale is not None:
                lengthscale = np.asarray(lengthscale)
                assert lengthscale.size == input_dim, "bad number of lengthscales"
            else:
                lengthscale = np.ones(input_dim)

        self.variance = Param('variance', variance, Logexp())
        assert self.variance.size == 1, "Variance size must be one"
        self.period = Param('period', period, Logexp())
        self.lengthscale = Param('lengthscale', lengthscale, Logexp())

        self.link_parameters(self.variance, self.period, self.lengthscale)
Ejemplo n.º 19
0
    def __init__(self,
                 gap_decay=1.0,
                 match_decay=2.0,
                 order_coefs=[1.0],
                 alphabet=[],
                 maxlen=0,
                 num_splits=1,
                 normalize=True):
        super(SplitStringKernel, self).__init__(1, None, "sk")
        self._name = "sk"
        self.num_splits = num_splits
        self.gap_decay = Param('Gap_decay', gap_decay, Logexp())
        self.match_decay = Param('Match_decay', match_decay, Logexp())
        self.order_coefs = Param('Order_coefs', order_coefs, Logexp())
        self.link_parameters(self.gap_decay, self.match_decay,
                             self.order_coefs)

        self.alphabet = alphabet
        self.maxlen = maxlen
        self.normalize = normalize

        # make new kernels for each section
        self.kernels = []
        for i in range(0, num_splits - 1):
            self.kernels.append(
                StringKernel(gap_decay=gap_decay,
                             match_decay=match_decay,
                             order_coefs=order_coefs,
                             alphabet=alphabet,
                             maxlen=int((self.maxlen / self.num_splits)),
                             normalize=normalize))
        # final kernel might be operating on slightly loinger string if maxlen/num_splits % !=0
        self.kernels.append(
            StringKernel(gap_decay=gap_decay,
                         match_decay=match_decay,
                         order_coefs=order_coefs,
                         alphabet=alphabet,
                         maxlen=int((self.maxlen / self.num_splits)) +
                         self.maxlen - self.num_splits * int(
                             (self.maxlen / self.num_splits)),
                         normalize=normalize))
        #tie the params across the kernels
        for kern in self.kernels:
            kern.unlink_parameter(kern.gap_decay)
            kern.gap_decay = self.gap_decay
            kern.unlink_parameter(kern.match_decay)
            kern.match_decay = self.match_decay
            kern.unlink_parameter(kern.order_coefs)
            kern.order_coefs = self.order_coefs
Ejemplo n.º 20
0
 def __init__(self, input_dim, input_space_dim=None, active_dims=None, name='shapeintegralhc',lengthscale=None, variances=None,Nrecs=10,step=0.025,Ntrials=10,dims=2):
     super(ShapeIntegralHC, self).__init__(input_dim, active_dims, name)
     assert ((input_space_dim is not None)), "Need the input space dimensionality defining"
     kernel = Integral(input_dim=input_space_dim*2,lengthscale=lengthscale,variances=variances)
     self.lengthscale = Param('lengthscale', kernel.lengthscale, Logexp())
     self.variances = Param('variances', kernel.variances, Logexp()) 
     self.link_parameters(self.variances, self.lengthscale) #this just takes a list of parameters we need to optimise.
     
     
     self.kernel = kernel
     self.input_space_dim = input_space_dim
     self.rectangle_cache = {} #this is important, not only is it a speed up - we also get the same points for each shape, which makes our covariances more stable        
     
     self.Nrecs=Nrecs
     self.step=step
     self.Ntrials=Ntrials
Ejemplo n.º 21
0
    def __init__(self,
                 input_dim,
                 variances=None,
                 delta=None,
                 ARD=False,
                 active_dims=None,
                 name='linear'):
        super(TruncLinear, self).__init__(input_dim, active_dims, name)
        self.ARD = ARD
        if not ARD:
            if variances is not None:
                variances = np.asarray(variances)
                delta = np.asarray(delta)
                assert variances.size == 1, "Only one variance needed for non-ARD kernel"
            else:
                variances = np.ones(1)
                delta = np.zeros(1)
        else:
            if variances is not None:
                variances = np.asarray(variances)
                delta = np.asarray(delta)
                assert variances.size == self.input_dim, "bad number of variances, need one ARD variance per input_dim"
            else:
                variances = np.ones(self.input_dim)
                delta = np.zeros(self.input_dim)

        self.variances = Param('variances', variances, Logexp())
        self.delta = Param('delta', delta)
        self.add_parameter(self.variances)
        self.add_parameter(self.delta)
Ejemplo n.º 22
0
    def __init__(self,
                 first,
                 second,
                 sigmoidal,
                 location: float = 0.,
                 slope: float = 0.5,
                 name='change_base',
                 fixed_slope=False):
        _newkerns = [kern.copy() for kern in (first, second)]
        super(ChangeKernelBase, self).__init__(_newkerns, name)
        self.first = first
        self.second = second

        self._fixed_slope = fixed_slope  # Note: here to be used by subclasses, and changing it from the outside does not link the parameter
        if self._fixed_slope: self.slope = slope
        else:
            self.slope = Param('slope', slope, Logexp())
            self.link_parameter(self.slope)

        if isinstance(location, tuple):
            self.sigmoidal = sigmoidal(1, False, 1., location[0], location[1],
                                       slope)
            self.sigmoidal_reverse = sigmoidal(1, True, 1., location[0],
                                               location[1], slope)
            self.location = Param('location', location[0])
            self.stop_location = Param('stop_location', location[1])
            self.link_parameters(self.location, self.stop_location)
        else:
            self.sigmoidal = sigmoidal(1, False, 1., location, slope)
            self.sigmoidal_reverse = sigmoidal(1, True, 1., location, slope)
            self.location = Param('location', location)
            self.link_parameter(self.location)
Ejemplo n.º 23
0
 def __init__(self):
     self.num_parameters = 4
     self.psi = Param('psi', np.zeros((1, 3)))
     self.d = Param('%s' % ('d'), 1.0, Logexp())
     super(IdentityFunction, self).__init__(name='identity')
     self.link_parameter(self.psi)
     self.link_parameter(self.d)
Ejemplo n.º 24
0
 def __init__(self,
              input_dim,
              output_dim,
              rank=1,
              W=None,
              kappa=None,
              active_dims=None,
              name='coregion'):
     super(Coregionalize, self).__init__(input_dim, active_dims, name=name)
     self.output_dim = output_dim
     self.rank = rank
     if self.rank > output_dim:
         print(
             "Warning: Unusual choice of rank, it should normally be less than the output_dim."
         )
     if W is None:
         W = 0.5 * np.random.randn(self.output_dim, self.rank) / np.sqrt(
             self.rank)
     else:
         assert W.shape == (self.output_dim, self.rank)
     self.W = Param('W', W)
     if kappa is None:
         kappa = 0.5 * np.ones(self.output_dim)
     else:
         assert kappa.shape == (self.output_dim, )
     self.kappa = Param('kappa', kappa, Logexp())
     self.link_parameters(self.W, self.kappa)
    def __init__(self,
                 Y_metadata,
                 gp_link=None,
                 noise_mult=1.,
                 known_variances=1.,
                 name='Scaled_het_Gauss'):
        if gp_link is None:
            gp_link = link_functions.Identity()

        if not isinstance(gp_link, link_functions.Identity):
            print(
                "Warning, Exact inference is not implemeted for non-identity link functions,\
            if you are not already, ensure Laplace inference_method is used")

        # note the known_variances are fixed, not parameterse
        self.known_variances = known_variances
        self.noise_mult = Param('noise_mult', noise_mult,
                                Logexp())  # Logexp ensures its positive
        # this is a parameter, so it gets optimized, gradients calculated etc.

        #super(ScaledHeteroscedasticGaussian, self).__init__(gp_link, variance=1.0, name=name)
        super(Gaussian, self).__init__(gp_link, name=name)
        # note: we're inheriting from Likelihood here, not Gaussian, so as to avoid problems with the Gaussian variance.

        #add a new parameter by linking it (see just above in GPy.likelihoods.gaussian.Gaussian).
        self.link_parameter(self.noise_mult)

        if isinstance(gp_link, link_functions.Identity):
            self.log_concave = True
Ejemplo n.º 26
0
    def __init__(
        self,
        mu,
        lam,
        A,
    ):
        super(Gompertz, self).__init__(1, 1, name='gompertz')

        self.mu = Param('mu', mu, Logexp())
        self.lam = Param('lam', lam, Logexp())
        self.A = Param('A', A, Logexp())

        #self.mu = Param('mu', mu)
        #self.lam = Param('lam', lam)
        #self.A = Param('A', A)

        self.link_parameters(self.mu, self.lam, self.A)
Ejemplo n.º 27
0
 def __init__(self, means, variances, binary_prob, tau=None,  name='latent space'):
     """
     binary_prob : the probability of the distribution on the slab part.
     """
     from paramz.transformations import Logexp
     super(SLVMPosterior, self).__init__(means, variances, binary_prob, group_spike=False, name=name)
     self.tau = Param("tau_", np.ones((self.gamma.shape[1],2)), Logexp())
     self.link_parameter(self.tau)
Ejemplo n.º 28
0
    def __init__(self,
                 input_dim,
                 a=1.,
                 b=1.,
                 c=1.,
                 variance_Yx=3.,
                 variance_Yt=1.5,
                 lengthscale_Yx=1.5,
                 lengthscale_Yt=1.5,
                 active_dims=None,
                 name='ode_st'):
        assert input_dim == 3, "only defined for 3 input dims"
        super(ODE_st, self).__init__(input_dim, active_dims, name)

        self.variance_Yt = Param('variance_Yt', variance_Yt, Logexp())
        self.variance_Yx = Param('variance_Yx', variance_Yx, Logexp())
        self.lengthscale_Yt = Param('lengthscale_Yt', lengthscale_Yt, Logexp())
        self.lengthscale_Yx = Param('lengthscale_Yx', lengthscale_Yx, Logexp())

        self.a = Param('a', a, Logexp())
        self.b = Param('b', b, Logexp())
        self.c = Param('c', c, Logexp())

        self.link_parameters(self.a, self.b, self.c, self.variance_Yt,
                             self.variance_Yx, self.lengthscale_Yt,
                             self.lengthscale_Yx)
Ejemplo n.º 29
0
    def __init__(self,
                 input_dim,
                 variance_U=3.,
                 variance_Y=1.,
                 lengthscale_U=1.,
                 lengthscale_Y=1.,
                 active_dims=None,
                 name='ode_uy'):
        assert input_dim == 2, "only defined for 2 input dims"
        super(ODE_UY, self).__init__(input_dim, active_dims, name)

        self.variance_Y = Param('variance_Y', variance_Y, Logexp())
        self.variance_U = Param('variance_U', variance_Y, Logexp())
        self.lengthscale_Y = Param('lengthscale_Y', lengthscale_Y, Logexp())
        self.lengthscale_U = Param('lengthscale_U', lengthscale_Y, Logexp())

        self.link_parameters(self.variance_Y, self.variance_U,
                             self.lengthscale_Y, self.lengthscale_U)
 def __init__(self,
              input_dim,
              variance=1.0,
              active_dims=None,
              name='catoverlap'):
     super().__init__(input_dim, active_dims=active_dims, name=name)
     self.variance = GPy.core.parameterization.Param(
         'variance', variance, Logexp())
     self.link_parameter(self.variance)