Decorators for Data Science
summary
Uses decorators inside Jupyter to solve real problems: LRU cache cuts a naive recursive Fibonacci at n=30 by over 400×, and memoizing a recursive Levenshtein on 10 words (100 pair runs) drops runtime from ~40,000 ms to ~10 ms. Implements JSON-on-disk caching that names files from bound arguments using inspect.signature, an SSH wrapper (paramiko-style) that runs commands remotely and returns remote cwd, and a record/replay decorator for regression tests plus ipywidgets interact for live Gaussian plots.
AI-written summary · about
chapters (9)
- 0:00Introduction to decorators
- 1:27What are decorators in Python
- 4:24Memoization with LRU cache
- 8:24Disk caching with JSON decorator
- 10:11Handling function arguments with inspect
- 12:45SSH decorator for remote commands
- 14:56Regression testing with decorators
- 16:25Interactive graphs in Jupyter
- 18:34Q&A and conclusion
related talks
02h 21mIntroduction to Decorators: Power Up Your Python Code
02h 32mIntroduction to Decorators: Power UP Your Python Code
02h 15mAll about decorators
09m9 Jupyter Notebook Tricks for Your Next Advent of Code
03h 21mIntroduction to Decorators: Power Up Your Python Code
02h 28mFunctional Python
35mWorking with data in Python for the Aspiring Data Scientists
28mUsing Python in a Data Hackathon
