4. Discussion: Two next-step proposals #4
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Prof. McSmartypants wants to try running the walker with a different next step proposal that looks like this:
Maybe we will need to add different step proposals later, so let's set this up properly, maybe by passing the proposal function to the walker. How should we design that code?
Exercise instructions:
Go to the notebook walker/Step_4_break_out_the_next_step_probability and follow the instructions. Comment here what you think the solution could look like. Also feel free to comment on other group's suggestions.
Make sure to include your suggested code snippet(s)
we would change the function
_next_step_proposalso that it takes a custom function that defines the probability distribution aroundcurrent_i, current_j. This custom function is passed to the constructor from outside the class.New module:
Class change:
imports: import both next_step_proposal_arguments and next_step_proposal
In the walker file, we define both functions. next_step_proposal uses the arguments that are supplied through the stars (**kwargs).
Before the walker instantiation we define a proposal_dict in which we add all the arguments and their values. In the instantiation of the walker, the proposal_dict file is supplied to next_step_proposal_arguments, which under the hood passes it to next_step_proposal.
from next_step_proposal import gaussian_next_step_proposal, square_next_step_proposala. Define walker(self, sigma_i, sigma_j,next_step_proposal,nect_step_proposal)arguement)
b.
walker = Walker(sigma_i=3, sigma_j=4, context_map=context_map, square_next_step_proposal, {'size':200, 'width':14})