Saved parameters and imputation
Task 7 · worked step 2
The training rows supply every replacement and scaling value. Filling a gap lets the model run, but does not recover the true measurement.
Lab 4 PDF pp. 6–7 · Task 7
Your task
Training minutes are 60,90,180 and missing. Save median 90 and fill the missing training value with 90. Fit the scaler on [60,90,180,90]: mean 105 and SD 45. Reuse the median and scaler for later records.
Evidence to include
Learn the fill value first, then the scaler.
Worked example and code
Try the task in the PDF first, then compare your working below. Run the code in your own Python notebook.
Open Lab 4 instructions (PDF)Observed training minutes are [60,90,180], median 90. Fill S4 and N1 with 90 using that saved median. Pandas converts None in a numerical column to NaN: use fillna, not an is None check on the resulting cell.
| Feature | Training mean after filling | Population SD (ddof=0) |
|---|---|---|
| score | 72.5 | 10.307764064 |
| minutes | 105 | 45 |
| early_logins | 8.5 | 5.722761571 |
Minutes per login are S1=30, S2=22.5, S3=15, S4=5.625, T1=35, T2 about 12.143 and N1=9. S4 and N1 ratios use imputed minutes, so mark that provenance. All login totals are positive here, giving zero-login indicators of 0. These ratios are explanatory outputs; they are not additional coordinates in the specified prediction vector.
Practice problems
Supplementary study questions on the lecture concepts — not verbatim exam questions. Each answer counts toward spaced review.
1. Conceptual understanding
Definitions and distinctions.
What is the saved median of training minutes [60,90,180]?
After filling S4, minutes [60,90,180,90] have which mean and population SD?
2. Application
Apply the concept to a case or calculation.
For training minutes [60,90,180,missing], which values determine the median replacement?
After filling the missing training minutes with 90, what is the total?
3. Interpretation and limitations
Evaluate assumptions and justify conclusions.
N1 receives 90 minutes, with saved mean 105 and SD 45. What is its scaled minutes coordinate?
Which row needs a minutes-imputed flag in the training set?
Explain it in writing
Self-checked, not marked. Write a few sentences, then compare with the example answer. Your writing is saved as you type.
Show an example answer
The completed training values sum to 420 and there are four rows, giving 105. The median of the originally observed training values was 90, which was used only as the replacement rule.
Check: did you answer the question, use evidence or working, and avoid claiming more than the evidence supports?
Show an example answer
No. It is an input prepared under the saved imputation rule. Keep its replacement flag and avoid describing it as a recovered observation.
Check: did you answer the question, use evidence or working, and avoid claiming more than the evidence supports?
Saved only in this browser. This note doesn’t fill in the downloaded notebook; “reviewed” is a personal checklist, not a grade.