Integrating Jupyter notebooks into the classroom to improve computational competence
The project
The lecture titled «Imaging and Computing in Medicine» (ICM) is an interdisciplinary lecture offered to bachelor’s students enrolled in the departments of Health Sciences and Technology (D-HEST), Mechanical and Process Engineering (D-MAVT), and Information Technology and Electrical Engineering (D-ITET). This lecture aims to bridge the gap between these diverse fields by offering a comprehensive exploration of the intersection between imaging technologies and computational methods as applied to medical science. To enhance the understanding gained through theoretical lessons, the goal of this Innovedum project was to supplement the lecture with accompanying practical modules. These hands-on sessions were intended to deepen the students› knowledge by allowing them to apply concepts in real-world scenarios, fostering a more profound comprehension of the subject matters. Nevertheless, it had been observed that students entering this course come with varying interests and levels of proficiency, particularly in programming, setting a challenge to ensure optimal learning outcomes regarding the practical lessons accompanying the lecture.
The aim of this project was to facilitate onboarding of students who lack the expected computational competence by providing interactive programming experience and improving student programming skills with visualization and simulation. To facilitate a more profound understanding of the mechanical background, the project also included an in-house 2D numerical solver (symplephys) for the finite element (FE) and finite difference (FD) methods that could be applied to various data for educational purposes. The chosen format for this Innovedum project was a flipped-classroom mini-course which was offered next to the ICM lecture.
The course integrated Jupyter notebooks into active learning sequences and includes an individual assessment tool on Moodle. Aligned with the ETH-wide Computational Competencies Initiative, the project aimed to enhance hands-on learning by deploying Jupyter notebooks in ETH classrooms. The project addressed unmet needs related to student preparedness for computational courses and aimed to make Jupyter widely applicable across departments.
Implementation into teaching practice
The project was concretely implemented in teaching through the following measures. Key project components were a computational onboarding mini-course integrated into Moodle, covering topics such as variables, programming languages, libraries, data visualization, image visualization, FE analysis, machine learning, and big data/statistical tests. Furthermore, the optimization and packaging of a simplified 2D FE-solver for broader community use was a key project component. Lastly, we developed and tested automatic grading tools for Jupyter Notebooks, addressing the labor-intensive manual assessment process.
Regarding the Minicourse Integration, we developed a well-structured computational onboarding minicourse, seamlessly integrating it into the Moodle platform. Built using the JupyterHub environment, the course was thoughtfully divided into seven sections: Variables, Basic Operations, and Programming Languages, Libraries and BIOS, Data Visualization Tools, Image Visualization Tools, Finite Element (FE) Analysis, Machine Learning, as well as Big Data and Statistical Tests. Each section was delivered as one module that the students completed individually.
Regarding the 2D Simulation Suite, our team optimized and packaged a 2D Finite Element Method (FEM) and Finite Difference Method (FDM) solver. The solver was used in 3 modules of the mini-course and in 2 courses (Imaging and Computing in Medicine and Multiscale Bone Biomechanics). Beyond its use within the minicourse, we made this solver available for the broader community and can be found on GitLab: https://gitlab.ethz.ch/kendallj/simplephys .
Regarding the Automatic Grading Implementation, and recognizing the manual assessment workload, we developed automatic grading tools specifically for Jupyter Notebooks. These tools underwent rigorous testing, retrospectively evaluating notebooks submitted by students in the Imaging and Computing in Medicine course in the FS2024.
Regarding Consultations and Inspirations, our project was significantly influenced by conversations with experts. Prof. Catherine Jutzeler, who teaches the class «Introduction to Python Programming,» provided invaluable insights. Dr. Falk Wittel from the civil engineering department, having successfully implemented automatic grading for his course «Digital Engineering,» shared practical experiences. Prof. Nicholas Bokulich ’s Jupyter notebooks-based introduction to programming for the Food Science curriculum served as an inspiring model.
Students gave positive feedback about the well-structured minicourse, appreciating the clear guidance it offered. Many expressed gratitude for the practical help, especially compared to other classes where Python assignment guidance was lacking. Part 4, focusing on visualization techniques, stood out as particularly enjoyable. The flexibility of completing notebooks at their own pace received almost universal agreement, surpassing the constraints of in-class schedules.
The project outcomes were disseminated through various channels, including the ETH website and the project deliverables are available as a minicourse on Moodle and an open-source software package on GitLab. The project was presented at the LET fair 2024 in the ETH main building in June 2024.
Lessons learned and further impacts
The three primary goals were achieved to the following extent:
Regarding the Computational Onboarding Minicourse, we successfully designed, implemented and field-tested a computational onboarding minicourse. The satisfaction level was measured using questionnaires. Furthermore, the course’s impact was recognized when students mentioned the clear guidance provided, especially in contrast to other classes lacking Python assignment support. One student’s feedback was “This was really helpful because in other classes, little to no guidance on how to use Python for assignments has been given.” Students found the minicourse well-structured and enjoyed completing notebooks at their own pace. Especially part 4, focusing on visualization techniques, stood out as particularly enjoyable and is the only module to the best of our knowledge that has already been used in other courses.
Regarding the developed 2D simulation suite, we fully achieved our goal of creating a 2D FEM and FDM solver. The impact was that students appreciated the practical application of numerical methods and their relevance to real-world problems, such as simulating the strain-distribution across a hip-implant. We received excellent feedback on the modules where we integrated the simulation software. It has also made our life as teachers easier for tracking changes and keeping the course software running smoothly.
Regarding the Automatic Grading Setup, we nearly achieved our aim of implementing an automatic grading setup. During the Innovedum project, we transitioned from NB-grader to autograder due to the discontinuation of NB-grader’s maintenance. As a deviation from the initially planned setup, due to time constraints, the link between Moodle and Jupyter was not yet established. However, this will be developed further by the Unit for Teaching and Learning (UTL) team in the future.
Among many Lessons Learned, the following examples stand out:
Do’s
– Test components in smaller parts before full implementation
Example: Test a single function in isolation to ensure it behaves as expected before integrating it with other parts of the code.
– Embed answers as functions for automatic grading
Example: Create a function calculate_area(radius) that returns the area of a circle, which can then be automatically graded by comparing the output.
– Include summaries and reminders within course materials
Example: At the end of a chapter on data structures, include a summary that outlines key points about lists, dictionaries, and their typical use cases.
– Utilize color coding in notebooks for clarity
Example: Use green for correct answers, red for errors, and blue for important notes within Jupyter notebooks to visually guide students through content.
Don’ts
– Avoid interdependencies between tasks to maintain flexibility
Example: Design exercises where each task is independent, so students can work on them in any order without being blocked by the completion of previous tasks.
– Minimize errors in test cells to prevent confusion
Example: Ensure that all test cases in a Jupyter notebook are error-free before distributing the notebook, so students aren’t confused by unintended failures.
– Use distinct variable names to prevent ambiguity
Example: Instead of using generic names like x or data, use descriptive names like user_input or temperature_reading to make the code more understandable.
In summary, our project successfully enhanced student learning through structured content, practical applications, and valuable feedback. These lessons can be applied to other contexts and larger student populations.
External Sponsor
Jose Guanter Fonds