Example #1
0
    def __str__(self):
        s = Parameterised.__str__(self).split('\n')
        # add priors to the string
        if self.priors is not None:
            strs = [str(p) if p is not None else '' for p in self.priors]
        else:
            strs = [''] * len(self._get_params())
        width = np.array(max([len(p) for p in strs] + [5])) + 4

        log_like = self.log_likelihood()
        log_prior = self.log_prior()
        obj_funct = '\nLog-likelihood: {0:.3e}'.format(log_like)
        if len(''.join(strs)) != 0:
            obj_funct += ', Log Prior: {0:.3e}, LL+Prior = {0:.3e}'.format(log_prior, log_like + log_prior)
        obj_funct += '\n\n'
        s[0] = obj_funct + s[0]
        s[0] += "|{h:^{col}}".format(h='Prior', col=width)
        s[1] += '-' * (width + 1)

        for p in range(2, len(strs) + 2):
            s[p] += '|{Prior:^{width}}'.format(Prior=strs[p - 2], width=width)

        return '\n'.join(s)
Example #2
0
File: model.py Project: jaidevd/GPy
    def __str__(self):
        s = Parameterised.__str__(self).split('\n')
        # add priors to the string
        if self.priors is not None:
            strs = [str(p) if p is not None else '' for p in self.priors]
        else:
            strs = [''] * len(self._get_params())
        width = np.array(max([len(p) for p in strs] + [5])) + 4

        log_like = self.log_likelihood()
        log_prior = self.log_prior()
        obj_funct = '\nLog-likelihood: {0:.3e}'.format(log_like)
        if len(''.join(strs)) != 0:
            obj_funct += ', Log Prior: {0:.3e}, LL+Prior = {0:.3e}'.format(
                log_prior, log_like + log_prior)
        obj_funct += '\n\n'
        s[0] = obj_funct + s[0]
        s[0] += "|{h:^{col}}".format(h='Prior', col=width)
        s[1] += '-' * (width + 1)

        for p in range(2, len(strs) + 2):
            s[p] += '|{Prior:^{width}}'.format(Prior=strs[p - 2], width=width)

        return '\n'.join(s)
Example #3
0
 def __init__(self):
     Parameterised.__init__(self)
     self.priors = None
     self.optimization_runs = []
     self.sampling_runs = []
     self.preferred_optimizer = 'scg'
Example #4
0
File: model.py Project: jaidevd/GPy
 def __init__(self):
     Parameterised.__init__(self)
     self.priors = None
     self.optimization_runs = []
     self.sampling_runs = []
     self.preferred_optimizer = 'scg'