Skip to content

Commit

Permalink
fewer default steps
Browse files Browse the repository at this point in the history
  • Loading branch information
dfm committed Jun 6, 2022
1 parent b6c77da commit 2023bc5
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions post.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"strt = time.time()\n",
"with simple_model:\n",
" simple_trace = pm.sample(\n",
" draws=3000, tune=3000, random_seed=42, return_inferencedata=True\n",
" draws=3000, tune=3000, random_seed=42, chains=2, return_inferencedata=True\n",
" )\n",
"\n",
" # About half the time is spent in tuning so correct for that\n",
Expand Down Expand Up @@ -116,7 +116,7 @@
"with model:\n",
" strt = time.time()\n",
" default_trace = pm.sample(\n",
" draws=10000, tune=5000, random_seed=42, return_inferencedata=True\n",
" draws=3000, tune=3000, random_seed=42, chains=2, return_inferencedata=True\n",
" )\n",
" default_time = 0.5 * (time.time() - strt)\n",
"\n",
Expand Down Expand Up @@ -258,10 +258,19 @@
"source": [
"The computational efficiency of this method is similar to PyMC3's default performance on an isotropic Gaussian (within a factor of a few) and corresponds to an improvement of more than *three orders of magnitude* over the default PyMC3 performance on a correlated Gaussian.\n",
"\n",
"While I've found that this procedure can substantially improve the sampling efficiency in many real world scenerios (especially during exploratory phases of a project), you shouldn't forget about reparameterization because that can provide even better performance and help identify problems with your model specification.\n",
"Futhermore, this method might run into numerical issues for high dimensional problems because more samples will be needed to reliably estimate the off-diagonal elements of the mass matrix.\n",
"Either way, hopefully this is helpful to folks until PyMC3 includes native support for this type of procedure."
"While I've found that this procedure can substantially improve the sampling efficiency in many real world scenarios (especially during exploratory phases of a project), you shouldn't forget about reparameterization because that can provide even better performance and help identify problems with your model specification.\n",
"Furthermore, this method might run into numerical issues for high dimensional problems because more samples will be needed to reliably estimate the off-diagonal elements of the mass matrix.\n",
"Either way, hopefully this is helpful to folks until PyMC3 includes native support for this type of procedure.\n",
"\n",
"*Edit: This feature is now available in PyMC3 using the* `init=\"adapt_full\"` *argument to* `pm.sample`."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down

0 comments on commit 2023bc5

Please sign in to comment.