adds step 4 exercise

This commit is contained in:
Lisa Schwetlick 2025-09-24 10:15:00 +02:00
parent 5455d9be1d
commit e96a56f177

View file

@ -10,7 +10,7 @@
} }
}, },
"source": [ "source": [
"# Break out the next step proposal\n", "# How can we break out the next step proposal?\n",
"\n", "\n",
"- We want a separate module for `next_step_proposals`, living in a separate file\n", "- We want a separate module for `next_step_proposals`, living in a separate file\n",
" - a Gaussian one (it's the one currently in the Walker code), called `gaussian_next_step_proposal`\n", " - a Gaussian one (it's the one currently in the Walker code), called `gaussian_next_step_proposal`\n",
@ -102,27 +102,11 @@
"plot_trajectory(trajectory, walker.context_map)" "plot_trajectory(trajectory, walker.context_map)"
] ]
}, },
{
"cell_type": "markdown",
"metadata": {
"nteract": {
"transient": {
"deleting": false
}
}
},
"source": [
"# 2. Implement the changes in the code\n",
"1. In a new module `next_step_proposals`, write two functions for two different next step proposals: a Gaussian one (it's the one currently in the Walker code) and a square one (you can find an example below)\n",
"2. Modify the constructor of Walker to take a `next_step_proposal` function and a `next_step_proposal_arguments` dictionary as an input\n",
"3. See if the dream code you wrote works with your implementation! (Don't forget to restart the kernel)"
]
},
{ {
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
"source": [ "source": [
"# What the square next step proposal could look like\n", "# What the square next step proposal could look like (info)\n",
"\n", "\n",
"This is an example of what the square next step proposal function could look like.\n", "This is an example of what the square next step proposal function could look like.\n",
"\n", "\n",
@ -175,6 +159,22 @@
"plt.colorbar()" "plt.colorbar()"
] ]
}, },
{
"cell_type": "markdown",
"metadata": {
"nteract": {
"transient": {
"deleting": false
}
}
},
"source": [
"# 2. Implement the changes in the code (optional)\n",
"1. In a new module `next_step_proposals`, write two functions for two different next step proposals: a Gaussian one (it's the one currently in the Walker code) and a square one (you can find an example below)\n",
"2. Modify the constructor of Walker to take a `next_step_proposal` function and a `next_step_proposal_arguments` dictionary as an input\n",
"3. See if the dream code you wrote works with your implementation! (Don't forget to restart the kernel)"
]
},
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 7, "execution_count": 7,