Upload
others
View
7
Download
0
Embed Size (px)
Citation preview
http://www.gnosis.cx/pycon-cuba-2016/
PyCon-Cuba 2016 Teaching Scientists Python David Mertz
page 1
Reflections onReflections onteaching Python toteaching Python toworking scientistsworking scientists
http://www.gnosis.cx/pycon-cuba-2016/
PyCon-Cuba 2016 Teaching Scientists Python David Mertz
page 2
Who am I?
Lead trainer for Continuum Analytics, since I startedthere in May 2015.
… the company that makes the Anaconda Pythondistribution, Bokeh, Numba, Dask, Blaze, and many otherFLOSS technologies.
… co-founder, Travis Oliphant created NumPy, for example.
… Jeff Reback is lead developer of Pandas.
… Lots more amazing folks to work with.
http://www.gnosis.cx/pycon-cuba-2016/
PyCon-Cuba 2016 Teaching Scientists Python David Mertz
page 3
Things I've done?
Director of the Python Software Foundation for 6 years;chair of PSF Outreach & Education Committee; chair ofPSF Trademarks Committee; chair of PSF/NumFOCUSScientific Python Working Group; chair of PSF Python-Cuba WG.
Wrote the IBM developerWorks column CharmingPython; the Addison-Wesley book Text Processing inPython; some short books on Python for O'Reilly; andvarious related articles.
For 8 years worked for a research lab, D. E. ShawResearch, who built the world's fastest supercomputer,Anton, for doing molecular dynamics.
http://www.gnosis.cx/pycon-cuba-2016/
PyCon-Cuba 2016 Teaching Scientists Python David Mertz
page 4
Styles of pedagogy
Different students benefit from differing emphases inteaching.
Computer science students and programmers
Financial analysts and quants
Data analysts
Domain area working scientists
http://www.gnosis.cx/pycon-cuba-2016/
PyCon-Cuba 2016 Teaching Scientists Python David Mertz
page 5
Styles of pedagogy
Different students benefit from differing emphases inteaching.
Computer science students and programmers
Enjoy language fundamental. Referencing computerscience concepts useful. Discussions of big-O notation,complexity, and data structures. More library/projectinterest than interactive exploration.
Financial analysts and quants
Data analysts
Domain area working scientists
http://www.gnosis.cx/pycon-cuba-2016/
PyCon-Cuba 2016 Teaching Scientists Python David Mertz
page 6
Styles of pedagogy
Different students benefit from differing emphases inteaching.
Computer science students and programmers
Financial analysts and quants
Have strong math background, but narrow focus ondomain they work in. Most appeal in teaching toolsand libraries. They love Pandas. Sometimes need tobreak their Excel habits.
Data analysts
Domain area working scientists
http://www.gnosis.cx/pycon-cuba-2016/
PyCon-Cuba 2016 Teaching Scientists Python David Mertz
page 7
Styles of pedagogy
Different students benefit from differing emphases inteaching.
Computer science students and programmers
Financial analysts and quants
Data analysts
Tend to focus on libraries specific to their needs(scikit-learn, Statsmodels). Broader domain interestthan quants. Sometimes have to ween them off Excelor SQL-only. Interactive exploration highly useful.
Domain area working scientists
http://www.gnosis.cx/pycon-cuba-2016/
PyCon-Cuba 2016 Teaching Scientists Python David Mertz
page 8
Styles of pedagogy
Different students benefit from differing emphases inteaching.
Computer science students and programmers
Financial analysts and quants
Data analysts
Domain area working scientists
Most fun to teach because of nimbleness of thought.Can generalize across domains, tools, etc. Notnecessarily in-depth knowledge of computer scienceor some applied math, but intellectually curious.
http://www.gnosis.cx/pycon-cuba-2016/
PyCon-Cuba 2016 Teaching Scientists Python David Mertz
page 9
Teach the students, not the curriculum
As in war, so in pedagogy: the “facts on the ground”are never exactly what plans anticipated.
Pay attention to what the students actually in front ofyou need, not what their managers said they need.
Where possible, survey students before class starts.
Get short written feedback during class.
http://www.gnosis.cx/pycon-cuba-2016/
PyCon-Cuba 2016 Teaching Scientists Python David Mertz
page 10
Teach the students, not the curriculum
As in war, so in pedagogy: the “facts on the ground”are never exactly what plans anticipated.
Once class actually starts, the background of students andthe technologies and techniques of most interest to themare probably different than you planned for.
Pay attention to what the students actually in front ofyou need, not what their managers said they need.
Where possible, survey students before class starts.
Get short written feedback during class.
http://www.gnosis.cx/pycon-cuba-2016/
PyCon-Cuba 2016 Teaching Scientists Python David Mertz
page 11
Teach the students, not the curriculum
As in war, so in pedagogy: the “facts on the ground”are never exactly what plans anticipated.
Pay attention to what the students actually in front ofyou need, not what their managers said they need.
The people you talk to in planning a course are rarely thesame people you actually teach. For scientists especially, itis better to pay attention to what the students believe theyshould learn.
Where possible, survey students before class starts.
Get short written feedback during class.
http://www.gnosis.cx/pycon-cuba-2016/
PyCon-Cuba 2016 Teaching Scientists Python David Mertz
page 12
Teach the students, not the curriculum
As in war, so in pedagogy: the “facts on the ground”are never exactly what plans anticipated.
Pay attention to what the students actually in front ofyou need, not what their managers said they need.
Where possible, survey students before class starts.
It's never a perfect match for the actual classroom, but awell-designed survey (on paper or online) of studentbackgrounds is very useful in tailoring a course accurately.
Get short written feedback during class.
http://www.gnosis.cx/pycon-cuba-2016/
PyCon-Cuba 2016 Teaching Scientists Python David Mertz
page 13
Teach the students, not the curriculum
As in war, so in pedagogy: the “facts on the ground”are never exactly what plans anticipated.
Pay attention to what the students actually in front ofyou need, not what their managers said they need.
Where possible, survey students before class starts.
Get short written feedback during class.
A very nice trick is to do a two question, anonymous surveyof all the students during breaks: (1) What is working best?(2) What is not working?
http://www.gnosis.cx/pycon-cuba-2016/
PyCon-Cuba 2016 Teaching Scientists Python David Mertz
page 14
Types of abstraction
We teach many very smart students. But in broadstrokes, they think differently.
Formal abstraction:
Mathematical generalization of data.
Domain abstraction:
Application of techniques to different fields.
http://www.gnosis.cx/pycon-cuba-2016/
PyCon-Cuba 2016 Teaching Scientists Python David Mertz
page 15
Types of abstraction
We teach many very smart students. But in broadstrokes, they think differently.
Formal abstraction
In broad strokes, the quants and data scientists arestrongest when they need to apply differentmathematical techniques to the “same” type of data theyare familiar with.
Domain abstraction...
http://www.gnosis.cx/pycon-cuba-2016/
PyCon-Cuba 2016 Teaching Scientists Python David Mertz
page 16
Types of abstraction
We teach many very smart students. But in broadstrokes, they think differently.
Formal abstraction...
Domain abstraction
Over-generalizing to the same degree, scientists andcomputer scientist are very strong at seeing the“sameness” of data arising from many content areas,even outside of their own specialty. E.g. astrophysics,hydrology, molecular dynamics are all just numbers towhich we can apply algorithms.
http://www.gnosis.cx/pycon-cuba-2016/
PyCon-Cuba 2016 Teaching Scientists Python David Mertz
page 17
Use Python 3.5
Legacy code doesn't matter for students!
There simply is enough better in 3.x (especially 3.5)that we do a disservice by teaching 2.7.
Teach compatibility shims, not 2.x.
http://www.gnosis.cx/pycon-cuba-2016/
PyCon-Cuba 2016 Teaching Scientists Python David Mertz
page 18
Use Python 3.5
Legacy code doesn't matter for students!
Yes, they may have to maintain older code, but that is notthe level at which general learning occurs. Make sure theylearn to think Pythonically first, worry about the versiondifferences later.
There simply is enough better in 3.x that we do adisservice by teaching 2.7.
Teach compatibility shims.
http://www.gnosis.cx/pycon-cuba-2016/
PyCon-Cuba 2016 Teaching Scientists Python David Mertz
page 19
Use Python 3.5
Legacy code doesn't matter for students!
There simply is enough better in 3.x that we do adisservice by teaching 2.x:
Some of the most important things for students to thinkabout are lazy sequences (iterators), asynchronousprogramming (coroutines), Unicode vs. bytes, maybeabstract base classes. In general, everything is cleaner inPython 3.5 than in earlier versions.
Teach compatibility shims.
http://www.gnosis.cx/pycon-cuba-2016/
PyCon-Cuba 2016 Teaching Scientists Python David Mertz
page 20
Use Python 3.5
Legacy code doesn't matter for students!
There simply is enough better in 3.x that we do adisservice by teaching 2.x.
Teach compatibility shims.
Use everything in: from __future__ import ...
Python-future is a great library!from future import standard_librarystandard_library.install_aliases()from future.builtins import (bytes, dict, int, list, object, range, str, ascii, chr, hex, input, next, oct, open, pow, round, super, filter, map, zip)
http://www.gnosis.cx/pycon-cuba-2016/
PyCon-Cuba 2016 Teaching Scientists Python David Mertz
page 21
Use Python 3.5
Legacy code doesn't matter for students!
There simply is enough better in 3.x that we do adisservice by teaching 2.x.
Teach compatibility shims.
Use almost everything in: from __future__ ...from __future__ import barry_as_FLUFLfrom __future__ import braces
http://www.gnosis.cx/pycon-cuba-2016/
PyCon-Cuba 2016 Teaching Scientists Python David Mertz
page 22
Customizing courses
Continuum developed an in-house tool to quicklypiece together learning material into courses tailoredfor a particular student group.
Name: Scientific Programming using AnacondaREADME: ./examples/README.py4sci.mdnotebooks: footers: [./templates/Footer.ipynb] headers: [./templates/Header.ipynb] notebooks: # Python Language Basics Basic Python: [ip_essentials, ip_datatypes, ip_ex_attributes]template: {class_date: 2016-04-04, instructor: David Mertz, Ph.D.}
http://www.gnosis.cx/pycon-cuba-2016/
PyCon-Cuba 2016 Teaching Scientists Python David Mertz
page 23
Jupyter notebooks
Interactive coding as extended REPL
Literate programming
Inline visualizations
Course as a shared project
Students keep personal work from class
http://www.gnosis.cx/pycon-cuba-2016/
PyCon-Cuba 2016 Teaching Scientists Python David Mertz
page 24
Jupyter notebooks
Interactive coding as extended REPL
Notebook cells are each little text editors that can also beexecuted in an IDE-like fashion. Moreover, the variablesdefined in one cell are available throughout the samenotebook.
Literate programming
Inline visualizations
Course as a shared project
Students keep personal work from class
http://www.gnosis.cx/pycon-cuba-2016/
PyCon-Cuba 2016 Teaching Scientists Python David Mertz
page 25
Jupyter notebooks
Interactive coding as extended REPL
Literate programming
Code can be interspersed with textual explanations orpedagogical background. This code can even includeequations rendered from LaTeX.
Inline visualizations
Course as a shared project
Students keep personal work from class
http://www.gnosis.cx/pycon-cuba-2016/
PyCon-Cuba 2016 Teaching Scientists Python David Mertz
page 26
Jupyter notebooks
Interactive coding as extended REPL
Literate programming
Inline visualizations
Graphics generated by matplotlib or Bokeh can appear asoutput cells within notebooks. Static graphics can also beincluded.
Course as a shared project
Students keep personal work from class
http://www.gnosis.cx/pycon-cuba-2016/
PyCon-Cuba 2016 Teaching Scientists Python David Mertz
page 27
Jupyter notebooks
Interactive coding as extended REPL
Literate programming
Inline visualizations
Course as a shared project
Developing the instructional notebooks partially inresponse to student questions make the final product feellike a collective effort.
Students keep personal work from class
http://www.gnosis.cx/pycon-cuba-2016/
PyCon-Cuba 2016 Teaching Scientists Python David Mertz
page 28
Jupyter notebooks
Interactive coding as extended REPL
Literate programming
Inline visualizations
Course as a shared project
Students keep personal work from class
Each student enhances her own copies of notebooks tocomplete exercises, experiment with language constructs,understand algorithms, etc. This acts as partially self-created reference after class.
http://www.gnosis.cx/pycon-cuba-2016/
PyCon-Cuba 2016 Teaching Scientists Python David Mertz
page 29
Reflections on teachingPython to working scientists
Questions?Questions?