$ show jeffheaton/app_deep_learning
Educational repository for Washington University's T81-558 'Applications of Deep Neural Networks' course by Jeff Heaton. It is a collection of over 60 Jupyter notebooks that serve as a textbook and hands-on labs, covering PyTorch fundamentals, tabular data, computer vision (CNNs, transfer learning), time series (LSTM, transformers), generative AI (Hugging Face, LLMs, diffusion), facial processing, explainability, reinforcement learning, and more. The code is heavily pedagogicalβdesigned for teaching, not productionβwith extensive markdown, inline comments, and reproducible training loops. All datasets are standard benchmarks (e.g., Auto MPG, Iris, sunspots) hosted externally or via sklearn. The repository has no CI/CD, tests, or deployment artifacts; it is purely instructional material accompanying a published arXiv textbook.
The LLM identified 5 files worth highlighting for reuse:
Implements a reusable EarlyStopping class with configurable patience, min_delta, and restore_best_weights. Encapsulates a common training pattern that can be extracted and applied to any PyTorch model. Demonstrates clean encapsulation and metric-based stopping logic.
Contains a self-contained RevIN (Reversible Instance Normalization) module and PositionalEncoding class for time-series transformers. These are generic, well-typed PyTorch modules that can be reused in any univariate/multivariate forecasting project. The transformer architecture (encoder-only with causal masking) is a clean template.
A model-agnostic perturbation_rank function that computes feature importance by shuffling each column and measuring loss increase. Works for regression and classification, is independent of model architecture, and uses efficient vectorized operations. Easily extractable as a standalone utility.
Implements a blend_ensemble function that combines predictions from multiple PyTorch and scikit-learn models via logistic regression stacking. The function is generic (accepts any list of models and training data) and demonstrates a professional ensemble pattern without hardcoding model internals.
Provides a complete Autoencoder class and training loop for anomaly detection on the digits dataset. The pattern (autoencoder β reconstruction error β anomaly threshold) is reusable for any unsupervised anomaly detection task. The code separates encoder, decoder, and detection logic cleanly.