Skip to content

Commit 1c86f70

Browse files
committed
Add softmax to math
1 parent 83b91d8 commit 1c86f70

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pymc3/math.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,9 @@ def invlogit(x, eps=sys.float_info.epsilon):
194194
"""The inverse of the logit function, 1 / (1 + exp(-x))."""
195195
return (1.0 - 2.0 * eps) / (1.0 + tt.exp(-x)) + eps
196196

197+
def softmax(x):
198+
"""Generalization of the inverse logit function to multiple dimensions."""
199+
return tt.nnet.softmax(x)
197200

198201
def logbern(log_p):
199202
if np.isnan(log_p):

0 commit comments

Comments
 (0)