

W03 / 2026-09-21 / 35 MIN / ENGLISH
Baselines, target types, and model assumptions
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
Beat a declared regression baseline
Using the worked notebook, compare the fitted regression with a training-mean predictor on the same test rows. Do not fit or select the model using test outcomes.
- 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.
from sklearn.metrics import mean_absolute_error
reg_pred=regression.predict(Xte)
mean_pred=np.full(len(yte),float(np.mean(ytr)))
observations['task1']={'ridge_MAE':float(mean_absolute_error(yte,reg_pred)),'mean_baseline_MAE':float(mean_absolute_error(yte,mean_pred)),'test_rows':len(yte)}
print(observations['task1'])Self-check: Both predictions must correspond to the same yte. Lower MAE is better for this declared metric, not proof of universal superiority.
TASK 2 / PREDICT - RUN - EXPLAIN
Change the target question
Compare the number of positive labels under thresholds 0 and 2. Explain why this changes the learning task rather than merely changing a display option.
- 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.
target_demo=np.array([-2.,-1.,0.,1.,2.,3.])
observations['task2']={'threshold_0':(target_demo>0).astype(int).tolist(),'threshold_2':(target_demo>2).astype(int).tolist()}
print(observations['task2'])Self-check: There are three positives at threshold 0 and one at threshold 2. A continuous target and a binary event require different metrics.
TASK 3 / PREDICT - RUN - EXPLAIN
Interpret coefficients with limits
Compare fitted coefficients with the synthetic generating coefficients. Explain the third feature and why a nonzero fitted coefficient is not automatically causal evidence.
- 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']={'fitted_coefficients':regression.coef_.tolist(),'generating_coefficients':[3,-2,0]}
print(observations['task3'])Self-check: Noise, finite data, correlations, and regularization can change fitted coefficients. Record an observed discrepancy rather than inventing an exact match.
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 W03-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.