Teaching with the IPython Notebook

by Thomas Arildsen

I have been teaching introductory Python for modelling and simulation and for scientific computing for a couple of years now. I am still somewhat new to Python myself, having “converted” from Matlab a couple of years ago. I find the open approach of using free and open source software instead of expensive proprietary software very motivating and I was easily talked into using it by my colleagues and quickly decided to base my teaching on it as well.

I started out basing my lessons on static slides with embedded Python code and output. Being a fairly hard-core LaTeX user, this was my natural approach, but I quickly found it unsatisfactory. Looking at static examples just does not seem very motivating and I tend to flick through them too quickly to get to the bottom of things.

I could just supplement my slides with examples done in IPython, for example, but that still doesn’t feel right to me. Using just the IPython terminal does not give the best presentation of code and output IMO. Along came the IPython Notebook which I didn’t really discover until I started to notice people tweeting about it.

The IPython notebook is great in many ways, for example for teaching/instruction, because it lets you combine nicely formatted comments, pieces of code, and the resulting output into one “document” using a web browser as the GUI. I started using notebooks as a supplement to my lessons where I would go through some slides and then switch to the IPython Notebook to live-demo some programming examples and walk the students through them. That has worked fairly well for me so far and I am quite happy with it, but I was still wondering how to take it further.

The decisive moment arrived when I came across this extension of the IPython Notebook: https://github.com/damianavila/live_reveal, by Damian Avila. I had noticed that the notebook can produce slideshows as well, but with this extension you can make the slideshows “live”. That is, you can show a nice, full-screen slideshow and edit, execute, and view the output inside the slideshow on-the-fly. This was no less than a revelation to me and I wanted to start using it in my teaching right away. I want to combine the lesson’s slides and examples into one coherent IPython sideshow with embedded live demos.

I did not find time to change my material for this fall’s course since I was building a new course as well (where I am not using any Python so far), but I want to incorporate it in a course I will be running for the third time in the spring.

Now comes the real question: instead of just blindly changing my material because it is my gut feeling that it will work better, I think I should take the opportunity to go about it more systematically to investigate what works and why. My own research is in signal processing so I am not used to seeing my own teaching as research and I am a bit on thin ice here as how to best go about this. I could try different things:

  • Maybe compare a class of students having been “exposed” to the old version to next year’s class where I use the new version of the material.

    How do I even measure one class’ learning from my material in a way that lets me compare it to the next class’ learning from the new material? Any difference observed might as well be due to the next class simply being a different group of people than the previous (the classes are fairly small which I guess increases such variability).

    Besides, this will take a long time, at least a year.

  • I could try doing some of the new lessons the old way and some the new way and then comparing across lessons (at most a week apart per lesson). That is, still assuming I have a reliable way to measure the outcome.

    If I do this, how do I then assure that differences observed are due to the difference in presentation and not merely the fact that the different lessons contain different topics?

I am going to try this out no matter what, but I feel that I could be missing out on a great opportunity for me, and possibly other instructors, to learn a valuable lesson myself here. I hope there are experienced instructors or teaching researchers out there willing to share their ideas and experiences on this, so please fire away.

Advertisements