4. Discussion: Two next-step proposals #4

Open
opened 2026-07-27 05:28:08 +02:00 by lisa · 0 comments
Owner

Prof. McSmartypants wants to try running the walker with a different next step proposal that looks like this:

def square_next_step_proposal(current_i, current_j, size, width):
    """ Square next step proposal. """
    grid_ii, grid_jj = np.mgrid[0:size, 0:size]
    inside_mask = (np.abs(grid_ii - current_i) <= width // 2) & (np.abs(grid_jj - current_j) <= width // 2)
    p_next_step = inside_mask / inside_mask.sum()
    return p_next_step

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)

Prof. McSmartypants wants to try running the walker with a different next step proposal that looks like this: ``` def square_next_step_proposal(current_i, current_j, size, width): """ Square next step proposal. """ grid_ii, grid_jj = np.mgrid[0:size, 0:size] inside_mask = (np.abs(grid_ii - current_i) <= width // 2) & (np.abs(grid_jj - current_j) <= width // 2) p_next_step = inside_mask / inside_mask.sum() return p_next_step ``` 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)**
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ASPP/2026-latam-scientific-patterns#4
No description provided.