Skip to content

Commit dab707a

Browse files
ferrinetwiecki
authored andcommitted
Use better api for svgd init
1 parent 6b80a7a commit dab707a

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

docs/source/notebooks/variational_api_quickstart.ipynb

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1310,8 +1310,9 @@
13101310
"source": [
13111311
"with model:\n",
13121312
" # We'll use SVGD\n",
1313-
" # So creating empirical approximation in advance is a good decision\n",
1314-
" approx = pm.Empirical.from_noise(size=500, jitter=1)\n",
1313+
" inference = pm.SVGD(n_particles=500, jitter=1)\n",
1314+
" # shortcut reference to approximation\n",
1315+
" approx = inference.approx\n",
13151316
" # Here we need `more_replacements` to change train_set to test_set\n",
13161317
" test_probs = approx.sample_node(z, more_replacements={\n",
13171318
" Xt: X_test\n",
@@ -1342,17 +1343,6 @@
13421343
"train_accuracy = train_ok.mean(-1)"
13431344
]
13441345
},
1345-
{
1346-
"cell_type": "code",
1347-
"execution_count": 56,
1348-
"metadata": {
1349-
"collapsed": true
1350-
},
1351-
"outputs": [],
1352-
"source": [
1353-
"inference = pm.SVGD(histogram=approx)"
1354-
]
1355-
},
13561346
{
13571347
"cell_type": "markdown",
13581348
"metadata": {},

0 commit comments

Comments
 (0)