Machine Learning Cheat Sheet
|
This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production. |
Four single-page, colour-coded summaries of the Machine Learning section, one per part: framework-neutral machine learning and deep learning, PyTorch, TensorFlow with Keras 3, and scikit-learn. They reflect Python 3.13, PyTorch 2.15, TensorFlow 2.21 with Keras 3.15 and scikit-learn 1.9 as checked in October 2026, and each is available as a downloadable PDF.
Machine Learning & Deep Learning
The learning types, a chooser for losses and metrics, activation and optimiser defaults, the training recipe, a checklist for a model that does not learn, overfitting remedies, an architecture chooser (MLP, CNN, recurrent network, transformer or gradient boosting), a framework chooser, deployment formats, and the targeted versions.
For the full explanation, every option and additional examples, see the dedicated pages:
Attention & Transformers: the Bridge to LLMs, Backpropagation & Automatic Differentiation, Books, Courses & Where to Follow Research, Choosing a Framework, Classic ML Algorithms at a Glance, Convolutional Neural Networks, Deploying & Serving ML Models, Distributed Training Concepts, Embeddings & Representation Learning, Experiment Tracking & MLOps for Training, Fairness & Responsible ML, Generalization, Bias–Variance & Regularization, Generative Models: Autoencoders, VAEs, GANs & Diffusion, Gradient Descent & Optimization, Graph Neural Networks, Hardware, Memory & Mixed Precision, Interpretability & Explainability, Loss Functions & Information Theory, Math for ML: Linear Algebra, Calculus & Probability, ML & Deep Learning Glossary, Model Compression: Quantization, Pruning & Distillation, Neural Network Fundamentals: Perceptron, MLP & Activations, ONNX & Model Interoperability, Optimizers & Learning-Rate Schedules, Problem Framing & the ML Project Lifecycle, Reinforcement Learning Basics, RNNs, LSTMs & GRUs, Tabular Data: Gradient Boosting vs Deep Learning, Training Deep Networks: Initialization, Normalization & Regularization, Transfer Learning, Fine-Tuning & Foundation Models, Tuning Deep Networks in Practice, Types of Learning, and What Is Machine Learning? AI vs ML vs DL.
PyTorch
Installation and index URLs, tensors and devices with torch.accelerator, autograd and grad modes, the nn.Module skeleton, losses and optimisers, the canonical training loop, DataLoader options, weights_only saving and loading, mixed precision, torch.compile, DDP and FSDP2 launch, the export paths (torch.export, ONNX and ExecuTorch) and the renames from legacy to current APIs in PyTorch 2.15.
For the full explanation, every option and additional examples, see the dedicated pages:
AOTInductor, Attention, SDPA, FlexAttention & Transformers, Autograd Fundamentals, Custom autograd Functions, Custom Operators, C++/CUDA Extensions & Triton, Datasets & DataLoader, Devices & Accelerators: CUDA, ROCm, MPS, XPU, CPU, Distributed Checkpoint & Flight Recorder, Distributed Overview, torchrun & Elastic, DistributedDataParallel, DTensor, Tensor & Pipeline Parallelism, Ecosystem: Lightning, Hugging Face, Captum, skorch, Ray & TorchRL, Embeddings, Normalization, Dropout & Activations, ExecuTorch for Mobile & Edge, Exporting to ONNX, FSDP2 (fully_shard), GPU Memory & Activation Checkpointing, Graph Breaks, Recompilation & Dynamic Shapes, Higher-Order Gradients & torch.func, Indexing, Views & Broadcasting, Installation & Versions, Learning-Rate Schedulers & SWA/EMA, Legacy APIs & Migration, Linear, Convolution & Pooling Layers, Loss Functions, Mixed Precision with torch.amp, nn.Module: Parameters, Buffers, state_dict, Hooks, Containers & Init, no_grad, inference_mode & Grad Modes, NumPy & DLPack Interop, Optimizers, Performance Tuning Guide, Profiling with torch.profiler, Quantization, Sparsity & Pruning with torchao, Reproducibility & Determinism, RNN, LSTM & GRU, Saving & Loading Models (weights_only), Sparse, Nested & Complex Tensors, TensorBoard Integration, Tensors: Creation, Attributes & Dtypes, The Training Loop & Evaluation, torch.compile, torch.export, torch.nn.functional, torchaudio (Maintenance) & TorchCodec, torchvision: Transforms v2, Models & Weights, Transfer Learning & Fine-Tuning, Worked Example: Character RNN & seq2seq, Worked Example: CNN Image Classifier, Worked Example: Transformer Building Blocks, and Workers, Pinned Memory & Samplers.
TensorFlow
The installation matrix, tensors and variables, GradientTape, the rules of tf.function, the Keras 3 model styles, compile and fit, callbacks, the tf.data recipe, the saving formats (.keras, .weights.h5 and export), mixed precision, tf.distribute, LiteRT and TensorFlow Serving, and the renames from TensorFlow 1 and Keras 2 to Keras 3 in TensorFlow 2.21.
For the full explanation, every option and additional examples, see the dedicated pages:
A Training Loop with TF Core, Attention & Transformers, Automatic Differentiation with GradientTape, Callbacks, compile, fit, evaluate & predict, Core Keras Layers, Customizing fit() with train_step, Devices: CPUs, GPUs & TPUs, Distributed Training: tf.distribute & the Keras Distribution API, Ecosystem & Project Status, Graphs, tf.function, AutoGraph & Retracing, Hyperparameter Tuning with KerasTuner, Image Classification with CNNs, Input Pipelines with tf.data & TFRecord, Installation: pip, GPU, WSL2 & macOS, Keras 3 Overview: keras, tf.keras & tf_keras, Keras Multi-Backend: JAX, PyTorch & keras.ops, Keras Preprocessing Layers, Loading Images, Text & Audio from Disk, Losses, Metrics, Migrating from Keras 2 to Keras 3, Migrating from TensorFlow 1, where older books and tutorials are outdated, Mixed Precision, Modules (tf.Module), NumPy Interop & tf.experimental.numpy, On-Device Inference with LiteRT, Optimizers & Learning-Rate Schedules, Performance, XLA & Profiling, Pre-trained Models with KerasHub, Quantization & Model Optimization, Ragged & Sparse Tensors, SavedModel & Signatures, Saving Keras Models: .keras, Weights & export, Sequential & Functional Models, Serving with TensorFlow Serving, Subclassing & Custom Layers, TensorBoard, TensorFlow Datasets (TFDS), Tensors, Dtypes & Random Numbers, Text, RNNs & Embeddings, tf.data Performance, TF.js, TFX & TF Probability (Positioning), Training Checkpoints, Transfer Learning & Fine-Tuning, Variables, and Writing a Training Loop from Scratch.
scikit-learn
The scikit-learn cheat sheet is shared with the Data Science section and is not duplicated: it covers the estimator API, choosing an estimator, preprocessing, pipelines with column transformers, splitters and search, metrics and displays, persistence and the renamed or removed APIs in scikit-learn 1.9. The topics below are the additional Machine Learning pages that the one-page PDF does not cover.
For the full explanation, every option and additional examples, see the introduction scikit-learn and the dedicated pages:
Building Custom Estimators & Transformers, Callbacks: Progress & Scoring Monitoring (experimental), Covariance & Density Estimation, End-to-End ML Project, Exporting Pipelines to ONNX, From scikit-learn to Deep Learning, Gaussian Processes, HistGradientBoosting vs XGBoost, LightGBM & CatBoost, Hyperparameter Tuning at Scale: Halving, Optuna & Parallelism, Imbalanced Data: class_weight, Thresholds & imbalanced-learn, Isotonic Regression, Kernel Ridge, Kernel Approximation & Nyström, Linear & Quadratic Discriminant Analysis, Multiclass, Multilabel & Multioutput Strategies, Neural Networks: MLPClassifier & MLPRegressor, PLS, CCA & Random Projection, Scaling Strategies & Out-of-Core Learning, Semi-Supervised Learning, and Using scikit-learn with PyTorch & Keras.