Skip to content

Commit 0533386

Browse files
Switching to pymc.math.softmax implementation; adding axis=1 argument to the softmax function for rethinking_2 chapter 11 notebook.
1 parent c24940c commit 0533386

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Rethinking_2/Chp_11.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4719,7 +4719,7 @@
47194719
" s2 = 0.0 + b * income[2] # pivoting the intercept for the third category\n",
47204720
" s = pm.math.stack([s0, s1, s2])\n",
47214721
"\n",
4722-
" p_ = at.nnet.softmax(s)\n",
4722+
" p_ = pm.math.softmax(s, axis=1)\n",
47234723
" career_obs = pm.Categorical(\"career\", p=p_, observed=career)\n",
47244724
"\n",
47254725
" trace_11_13 = pm.sample(tune=2000, target_accept=0.99, random_seed=RANDOM_SEED)\n",
@@ -5061,7 +5061,7 @@
50615061
" s2 = np.zeros(N) # pivot\n",
50625062
" s = pm.math.stack([s0, s1, s2]).T\n",
50635063
"\n",
5064-
" p_ = at.nnet.softmax(s)\n",
5064+
" p_ = pm.math.softmax(s, axis=1)\n",
50655065
" career_obs = pm.Categorical(\"career\", p=p_, observed=career)\n",
50665066
"\n",
50675067
" trace_11_14 = pm.sample(1000, tune=2000, target_accept=0.9, random_seed=RANDOM_SEED)\n",

0 commit comments

Comments
 (0)