Module 4 · Foundations

Module 4: implement, explain and transfer

Read concepts, then attempt the starter notebook. In a source checkout open notebooks/practice/module04-practice.ipynb. Use the core environment and kernel; the practice checks need NumPy even where the module script does not. Three unfinished functions report not_attempted, not a pass. If a download link does not open, use the offline access route.

Construct error_rate

Return errors/requests; None when requests is zero. Predict the result on error_rate(3, 10), implement it and call m04_error_rate through the notebook check. Then add a changed case and explain which assumption it tests.

Hint for error_rate

A zero denominator is unavailable, not zero percent.

Construct median

Return the median of a nonempty numerical list, without changing the input. Predict the result on median([1, 2, 3, 100]), implement it and call m04_median through the notebook check. Then add a changed case and explain which assumption it tests.

Hint for median

Average the two middle observations for an even count.

Construct weighted_rate

Input pairs [errors, requests]. Return total errors / total requests, or None. Predict the result on weighted_rate([[1, 2], [1, 8]]), implement it and call m04_weighted_rate through the notebook check. Then add a changed case and explain which assumption it tests.

Hint for weighted_rate

Do not average daily percentages with unequal denominators.

Work with the complete study's results

Run the Module 4 exploration and open request_latency.csv. Apply your median to the observed p95_latency_ms values, leaving out the unavailable one. Compare your result with "Median daily service p95" in summary.txt, and explain why the mean in the same file is higher. Compare with the construction feedback afterwards.

Reason beyond the visible checks

Choose daily counts [errors, requests] for two days so that the average of the daily error rates differs from weighted_rate. Explain which number answers "what fraction of all requests failed?" The checks cannot mark this; compare your reasoning with the construction feedback.

Transfer to an IT decision

Compare request counts and error rates for two services with unequal volume. Write a caption that prevents a misleading ranking. Run the complete module study and verify one claim against its actual artifacts; keep the evidence the study workflow lists.

Evidence and feedback

You need basic functions, file paths, and dataframe selection/grouping. Use the foundation bridge, Module 2, or Module 3 as needed. You may enter here directly with the complete source archive and setup below.

Use construction feedback after an attempt and recorded experiment feedback for the full workflow. Follow the shared study workflow for evidence, recovery and optional AI disclosure. Official assessment weights remain with your instructor.

Evidence activity: Check a denominator

Use the exported observations and summary tables. Recalculate one overall rate from its total numerator and denominator and compare it with an unweighted average of per-period rates. Explain any difference and which question each calculation answers.

Follow the four steps in reproduce a result and justify its use. Submit your artifact path, independent calculation, discrepancy or agreement, and bounded use decision in the evidence worksheet. Use your complete reference run; this activity complements the small function checks.