Computes the information content of the specified type: -log_e(p(X))
346028
def information(self, type):
        """"""
        if not self.base:
            return -math.log(self._dist[type])
        else:
            return -math.log(self._dist[type], self.base)
559047
def logpt(self, t, xp, x):
        """"""
        return self.ssm.PX(t, xp).logpdf(x)
827222
private static double logSumExp(double[] x) {
    double max = x[0];
    for(int i = 1; i < x.length; i++) {
      final double v = x[i];
      max = v > max ? v : max;
    }
    final double cutoff = max - 35.350506209; // log_e(2**51)
    double acc = 0.;
    for(int i = 0; i < x.length; i++) {
      final double v = x[i];
      if(v > cutoff) {
        acc += v < max ? FastMath.exp(v - max) : 1.;
      }
    }
    return acc > 1. ? (max + FastMath.log(acc)) : max;
  }
1195638
def logsumexp(x):
    """"""
    max_x = np.max(x)
    return max_x + np.log(np.sum(np.exp(x - max_x)))
66008
def hessian_local_log_likelihood(self, x):
        
        C, D, u, y = self.C, self.D, self.inputs, self.data
        psi = x.dot(C.T) + u.dot(D.T)
        p = 1. / (1 + np.exp(-psi))
        dp_dpsi = p * (1 - p)
        return np.einsum('tn, ni, nj ->tij', -dp_dpsi, self.C, self.C)
309994
private double logLikelihood(int[] contingencyTable) {
        // Rename for short-hand convenience
        int[] t = contingencyTable;
        int col1sum = t[0] + t[2];
        int col2sum = t[1] + t[3];
        int row1sum = t[0] + t[1];
        int row2sum = t[2] + t[3];
        double sum = row1sum + row2sum;
        
        // Calculate the expected values for a, b, c, d
        double aExp = (row1sum / sum) * col1sum;
        double bExp = (row1sum / sum) * col2sum;
        double cExp = (row2sum / sum) * col1sum;
        double dExp = (row2sum / sum) * col2sum;

        return 2 *
            ((t[0] * Math.log(t[0] - aExp))  +
             (t[1] * Math.log(t[1] - bExp))  +
             (t[2] * Math.log(t[2] - cExp))  +
             (t[3] * Math.log(t[3] - dExp)));
    }
82413
def _compute_logP_from_ll(self):
        
        log = math.log
        logP = []
        for i in range(self.width):
            D = {}
            for L in ACGT:
                ''' if   ll = log(p/b) then
                       2^ll = p/b
                  and    ll = log(p) - log(b)
                  so log(p) = ll + log(b)'''
                #Pij = pow(2.0, self.ll[i][letter]) * self.background[letter]
                D[L] = self.ll[i][L] + log(self.background[L])/log(2.)
            logP.append(D)
        self.logP = logP
69179
def _get_log_prior_cl_func(self):
        
        return SimpleCLFunction.from_string('''
            mot_float_type _computeLogPrior(local const mot_float_type* x, void* data){
                return ''' + self._log_prior_func.get_cl_function_name() + '''(x, data);
            }
        ''', dependencies=[self._log_prior_func])
1134996
def pdf(self, x, e=0., w=1., a=0.):
        
        t = (x-e) / w
        return 2. / w * stats.norm.pdf(t) * stats.norm.cdf(a*t)
284038
def p_information_conversion(self, p):
        ''
        logger.debug(
            'information = information %s in information unit %s', p[1], p[3])
        p[0] = '{0: {1}}'.format(p[1], p[3])
11581
def func(self, p):
        
        self._set_stochastics(p)
        try:
            return -1. * self.logp
        except ZeroProbability:
            return Inf
1263344
def nice_log(x):
    
    neg = x < 0
    xi = np.log2(np.abs(x) + 1)
    xi[neg] = -xi[neg]
    return xi
495721
def logpt(self, t, xp, x):
        
        raise NotImplementedError(err_msg_missing_trans %
                                  self.__class__.__name__)
950881
def logpdf(self, p, lognorm=None):
        
        if lognorm is None:
            lognorm = self.log_norm
        if hasattr(p, 'keys'):
            if isinstance(p, _gvar.BufferDict):
                p = p.buf
            else:
                p = _gvar.BufferDict(p).buf
        else:
            p = numpy.asarray(p).reshape(-1)
        return (
            -0.5 * (numpy.sum(self.chiv(p) ** 2) - self.chi2)
            - self.log_gnorm - self.log_norm
            )
1097762
def log_conditional_likelihood(self, x):
        
        T, D = self.T, self.D_latent
        assert x.shape == (T, D)

        ll = 0
        for t in range(self.T):
            ll += self.local_log_likelihood(x[t], self.data[t], self.inputs[t])
        return ll
811659
def log1p(x):
    
    if isinstance(x, UncertainFunction):
        mcpts = np.log1p(x._mcpts)
        return UncertainFunction(mcpts)
    else:
        return np.log1p(x)
1200658
def horner_log(coeffs, log_coeff, x):
    ''''''
    tot = 0.0
    for c in coeffs:
        tot = tot*x + c
    return tot + log_coeff*log(x)