UofT-DSI | DSI | - Assignment 2#383
Open
zaf-tech wants to merge 5 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes are you trying to make? (e.g. Adding or removing code, refactoring existing code, adding reports)
Completed the three required parts of
assignment_2.ipynb:inflammation_01.csvwithreadlines()and printed each row.patient_summary(file_path, operation)usingnp.loadtxt+np.mean/np.max/np.minwithaxis=1to summarize each of the 60 patients' 40-day flare-up counts.detect_problems(file_path), which callspatient_summary(file_path, 'mean')and passes the result to the providedcheck_zeros()helper.What did you learn from the changes you have made?
How NumPy's
axisparameter controls whether a reduction (mean/max/min) is applied per-row vs per-column —axis=1was needed here to get one summary value per patient (row) rather than per day (column). Also reinforced composing small functions (patient_summary→detect_problems) instead of duplicating logic.Was there another approach you were thinking about making? If so, what approach(es) were you thinking of?
Could have used
pandas.read_csv+DataFrame.mean(axis=1)instead ofnp.loadtxt. Stuck with NumPy since that's what the assignment hints and course slides (10_numpy) pointed to, and it avoids adding a pandas dependency for a one-off summary.Were there any challenges? If so, what issue(s) did you face? How did you overcome it?
My local
assignment-2branch had drifted from a stale remote branch with an older solution attempt; I reset it to start clean frommain. Separately, this repo's rootpyproject.tomlpulls in a large, unrelated dependency set (deploying-ai-env) that fails to build on this machine's Python version, souv runat the project root couldn't execute the notebook. I worked around it by runningjupyter nbconvert --executein an isolated environment (uv run --no-project --with numpy --with nbconvert --with ipykernel) so I could verify the notebook end-to-end without touching the project's dependency file.How were these changes tested?
Executed the full notebook non-interactively via
jupyter nbconvert --to notebook --executeand confirmed the real outputs:inflammation_01.csv.len(patient_summary(all_paths[0], 'min'))→60, as required.detect_problems(all_paths[0])→False, matching the expected result.A reference to a related issue in your repository (if applicable)
Checklist