Skip to content

Commit c0463f5

Browse files
ferrinetwiecki
authored andcommitted
more verbose description for iris replacements
1 parent 95acf9f commit c0463f5

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

docs/source/notebooks/variational_api_quickstart.ipynb

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1240,7 +1240,9 @@
12401240
{
12411241
"cell_type": "code",
12421242
"execution_count": 52,
1243-
"metadata": {},
1243+
"metadata": {
1244+
"collapsed": true
1245+
},
12441246
"outputs": [],
12451247
"source": [
12461248
"# First of all\n",
@@ -1269,7 +1271,9 @@
12691271
{
12701272
"cell_type": "code",
12711273
"execution_count": 53,
1272-
"metadata": {},
1274+
"metadata": {
1275+
"collapsed": true
1276+
},
12731277
"outputs": [],
12741278
"source": [
12751279
"Xt = theano.shared(X_train)\n",
@@ -1285,7 +1289,15 @@
12851289
"cell_type": "markdown",
12861290
"metadata": {},
12871291
"source": [
1288-
"To get accuracy under approximate posterior we need to use `apply_replacements` or `sample_node`. It's better to get the whole distribution at each step to draw neat plot so `sample_node` is our choice."
1292+
"### Applying replacements in practice\n",
1293+
"Models defined with pymc3 have symbolic inputs for latent variables. To evaluate an espression that requires knoledge about latents one needs to pass values for latent variables. In VI setup we have an approximation for these variables ant it happens to be very usefull in practice. Having a simple functions that removes all symbolic dependencies is valuable. These functions are `sample_node` and `apply_replacements` described above. Before we did not use the full power of replacements. There is a usefull shortcut for applying even more replacements at once. \n",
1294+
"\n",
1295+
"To get accuracy under approximate posterior we need to use `apply_replacements` or `sample_node`. It's better to get the whole distribution at each step to draw neat plot so `sample_node` is our choice. As mentioned above we can apply more replacements in single function call. It can be done with readable kwarg `more_replacements` in both replacement functions.\n",
1296+
"\n",
1297+
"**HINT:** You can use `more_replacements` argument when calling `fit` too\n",
1298+
"\n",
1299+
" * `pm.fit(more_replacements={full_data: minibatch_data})`\n",
1300+
" * `inference.fit(more_replacements={full_data: minibatch_data})`"
12891301
]
12901302
},
12911303
{
@@ -1319,7 +1331,9 @@
13191331
{
13201332
"cell_type": "code",
13211333
"execution_count": 55,
1322-
"metadata": {},
1334+
"metadata": {
1335+
"collapsed": true
1336+
},
13231337
"outputs": [],
13241338
"source": [
13251339
"test_ok = tt.eq(test_probs.argmax(-1), y_test)\n",
@@ -1349,7 +1363,9 @@
13491363
{
13501364
"cell_type": "code",
13511365
"execution_count": 57,
1352-
"metadata": {},
1366+
"metadata": {
1367+
"collapsed": true
1368+
},
13531369
"outputs": [],
13541370
"source": [
13551371
"eval_tracker = pm.callbacks.Tracker(\n",

0 commit comments

Comments
 (0)