Skip to content

Commit 6210f22

Browse files
springcoiltwiecki
authored andcommitted
STY PEP8 for math.py (#1326)
1 parent fb4a476 commit 6210f22

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

pymc3/math.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,26 @@
11
from __future__ import division
2-
from theano.tensor import constant, flatten, zeros_like, ones_like, stack, concatenate, sum, prod, lt, gt, le, ge, eq, neq, switch, clip, where, and_, or_, abs_
3-
4-
from theano.tensor import exp, log, cos, sin, tan, cosh, sinh, tanh, sqr, sqrt, erf, erfinv, dot
2+
from theano.tensor import constant, flatten, zeros_like, ones_like, stack, concatenate, sum, prod, lt, gt, le, ge, eq, \
3+
neq, switch, clip, where, and_, or_, abs_
4+
from theano.tensor import exp, log, cos, sin, tan, cosh, sinh, \
5+
tanh, sqr, sqrt, erf, erfinv, dot
56
from theano.tensor import maximum, minimum, sgn, ceil, floor
6-
7-
from theano.tensor.nlinalg import det, matrix_inverse, extract_diag, matrix_dot, trace
7+
from theano.tensor.nlinalg import det, matrix_inverse, \
8+
extract_diag, matrix_dot, trace
89
from theano.tensor.nnet import sigmoid
910
import theano
1011
import theano.tensor as tt
1112
import sys
1213

14+
1315
def logsumexp(x, axis=None):
14-
# Adapted from https://github.com/Theano/Theano/issues/1563
15-
x_max = tt.max(x, axis=axis, keepdims=True)
16-
return tt.log(tt.sum(tt.exp(x - x_max), axis=axis, keepdims=True)) + x_max
16+
# Adapted from https://github.com/Theano/Theano/issues/1563
17+
x_max = tt.max(x, axis=axis, keepdims=True)
18+
return tt.log(tt.sum(tt.exp(x - x_max), axis=axis, keepdims=True)) + x_max
19+
1720

1821
def invlogit(x, eps=sys.float_info.epsilon):
1922
return (1 - 2 * eps) / (1 + tt.exp(-x)) + eps
2023

24+
2125
def logit(p):
22-
return tt.log(p/(1-p))
26+
return tt.log(p / (1 - p))

0 commit comments

Comments
 (0)