

W07-H1 / 2026-10-19 / 15 MIN / ENGLISH
LSTM memory, safe windows, and honest comparisons
Classroom formative practice. This does not add a weekly graded assignment. The exercise time is included in class practice, not added after the three-hour meeting.
Before you start
- Use a CPU runtime. Save a personal copy or open the downloaded notebook in Jupyter.
- Run the included complete walkthrough first. Read its setup, definitions, and checkpoints.
- Predict before running each exercise cell; then change only the requested factor.
- Keep your actual outputs, configuration, explanation, and limitation. Free tools are sufficient.
TASK 1 / PREDICT - RUN - EXPLAIN
Predict a gate intervention
Calculate the original cell and hidden output on paper. Then set i=0 and explain why the new cell is not necessarily the old cell.
- Write your prediction in the notebook response field before running.
- Run the starter cell below after the worked walkthrough.
- Make the requested controlled change and record the configuration.
- Explain the mechanism using the actual output, not an invented result.
old_c,f_demo,i_demo,g_demo,o_demo=.8,.9,.2,-.5,.7
new_c=f_demo*old_c+i_demo*g_demo
no_write_c=f_demo*old_c
observations['task1']={'new_cell':new_c,'hidden':float(o_demo*np.tanh(new_c)),'cell_when_i_zero':no_write_c}
print(observations['task1'])Self-check: The original cell is 0.62 and hidden output is about 0.386. With i=0, the cell is 0.72 because the forget gate still scales old memory.
TASK 2 / PREDICT - RUN - EXPLAIN
Prove the target is absent from history
For target index 1280 and window length 24, list the first and last history indices. Change the slicing endpoint to include the target and detect the leak.
- Write your prediction in the notebook response field before running.
- Run the starter cell below after the worked walkthrough.
- Make the requested controlled change and record the configuration.
- Explain the mechanism using the actual output, not an invented result.
origin_demo,window_demo=1280,24
safe_history=np.arange(origin_demo-window_demo,origin_demo)
unsafe_history=np.arange(origin_demo-window_demo+1,origin_demo+1)
observations['task2']={'first':int(safe_history[0]),'last':int(safe_history[-1]),'length':len(safe_history),'safe':bool((safe_history<origin_demo).all()),'leaky_version_is_safe':bool((unsafe_history<origin_demo).all())}
print(observations['task2'])Self-check: The safe indices are 1256 through 1279. There are 24 values and no target index. Including 1280 is leakage.
TASK 3 / PREDICT - RUN - EXPLAIN
Defend the model comparison
Read the actual metric table produced by the worked notebook. Identify the best baseline/model under MAE and explain the comparison even if LSTM loses.
- Write your prediction in the notebook response field before running.
- Run the starter cell below after the worked walkthrough.
- Make the requested controlled change and record the configuration.
- Explain the mechanism using the actual output, not an invented result.
observations['task3']={'actual_model_metrics':metrics}
print(observations['task3'])Self-check: Use your actual run, the same target indices, and original target units. Do not claim LSTM wins unless the observed table supports it.
Completion checklist
- Three predictions and three explanations.
- One controlled change with its actual outcome.
- One limitation and a brief AI-use/checking disclosure, or "none".
- A downloaded W07-H1-evidence.json, then a two-minute peer explain-back.
The notebook marks incomplete response records as drafts. Completing the fields is not proof that an explanation is correct.
The guided walkthroughs were previously executed. The new exercise extension cells have not yet been execution-tested for this revision. Agent exercises are deterministic simulations; no paid model or consequential external action is used.