Transforming AI Learning with Jupyter Notebooks

Jul 10, 2024

By: Shannon Borden

With a name like Jupyter Notebooks, you’d think we’re talking about the world’s coolest school supply from the future. And you wouldn't be far off!

Jupyter Notebooks, named in homage to Galileo's discovery of the moons of Jupiter, stands for Julia, Python, and R—three core coding languages. But what are Jupyter Notebooks beyond their cool name? Today, we’ll take a closer look at what Jupyter Notebooks are, how they’re used, and how Kira is using them to create unrivaled AI coursework.


What are Jupyter Notebooks?

Jupyter Notebooks allow for runnable code to be integrated directly within text documents. This means you can write and run code directly from the notebook without needing separate explanatory documents and linked code files.

Each notebook is an interactive document containing one or more cells of executable code, typically in Python, but also supporting other languages like Julia and R. Commonly used in data science AI, and machine learning, Jupyter Notebooks integrate written and visual documentation and conclusions drawn from data analysis with the code used to perform that analysis.

In a nutshell: You can write and edit code, use text and visualizations to explain why you wrote that code, and explain the results, all within a single document.


How are they used?

Jupyter Notebooks are commonly used in AI and data science fields, making them ideal for classroom environments. This means that using Jupyter Notebooks aligns students’  learning with the tools used by professional data scientists and machine learning engineers.

Jupyter notebooks are often used when writing large computer programs to split them up into smaller, more digestible pieces. Each of these smaller chunks of code can be contained within its own separate “cell” in a notebook, while having knowledge of the code and context of the other cells in the notebook. 

For example, if a function is defined in one cell in the notebooks, then that function can be used while writing code in a separate cell within the same notebook. This cell would know that this function has already been defined in a different cell.

Being able to split up a large program in this way makes it easier to debug the program and improves the overall learning experience. Students are able to learn and practice writing a large program in byte size sections while understanding how these different, smaller sections of code relate to each other within the entire notebook. 

Each of these cells can be executed on its own or the entire notebook can be executed, in which case all of the code cells would execute in the proper sequence. 

Jupyter Notebooks are heavily extensible, allowing images, videos, exercises, and code samples to be included in one place. Students don’t have to switch in and out of the notebook environment as they hone their skills.


How are Jupyter Notebooks used in Kira’s platform and courses?

Kira Learning is the first online learning platform to integrate Jupyter Notebooks directly into our courses. As students progress through Kira’s AI course, they interact with large data sets and write computationally intensive programs. 

We achieved this through a creative implementation of JupyterLab, an open-source web-based interactive development environment that enhances the functionality of Jupyter Notebooks, code, and data. It allows users to create and share documents with live code, equations, visualizations, and narrative text, all within a flexible and user-friendly interface, making it an ideal tool for both learning and professional development in AI.

Additionally, JupyterLab allows Kira users to download large data sets or install numerous Python packages without wasting valuable instruction time or burdening teachers with technical issues. By hosting students’ Jupyter Notebooks on pre-configured JupyterLab servers, we provide each student with a ready-to-use JupyterLab environment. 

When a student opens their AI course, JupyterHub starts a new JupyterLab server preconfigured with the necessary libraries. A Jupyter Notebook, pre-populated with the corresponding Kira lesson, is then embedded within Kira for student access. 

With a custom JupyterLab extension, student progress is tracked and sent to Kira’s platform, allowing for seamless activity submissions directly from the Jupyter Notebook, providing a functional environment from the moment teachers or students open an AI course.


Using Kira’s AI Tutor with Jupyter Notebooks:

While working through the AI course, students also have the option to use the AI tutor that is embedded within the notebook. 

If a student is stuck on a problem, then they can use the AI tutor to give them incremental guidance without giving away the answer. The AI tutor uses GPT-4 as the language model in the backend, and it uses context about the specific problem the student is on, the code that the student has written so far, the code output, and the solution code. 

The AI tutor also has the context of code written in the rest of the notebook. By using all of this information, the AI tutor is able to help the student become unstuck and continue making progress while still being mindful to not give away the correct solution.

With the AI Tutor as a tool to help students in their learning journey while they take the AI course, students can quite literally use AI to learn AI.


Real-world example of Jupyter Notebooks in action

Imagine a scientist wants to know if a penguin’s bill size varies based on its island of origin. They want to predict the island a penguin comes from based on bill measurements.

After collecting measurements from many penguins (labeled with their island), the scientist trains a machine learning model on this data. But to make the research accessible, they can create a Jupyter Notebook.

The notebook can contain the purpose of the research, methods used to collect the data, and the actual Python code to train the predictive model. Readers can run the code, generate a model, and classify their own penguin data. Python code in the notebook can generate visualizations like graphs that render when run.

Readers can modify the code for their research and verify outcomes by running the code themselves.


Try it for yourself!

Jupyter Notebooks revolutionized AI engineering, and presented an opportunity to accomplish the same for AI teaching and learning by providing an integrated, interactive, and practical learning environment. By adopting this technology, Kira ensures that students gain hands-on experience with the same tools used by professionals in the field.


To learn more about Kira’s use of Jupyter Notebooks in our AI course and to experience it firsthand, sign up for a trial account.