Author: Suyog Garg, Dated: 2025/11/18
Accompanying notebooks:
artifacts/*_metrics.json)All notebooks save plots and metrics into ./artifacts/ for later comparison.
fit/score, CV, and grid‑search around a Keras CNN.The comparison notebook summarizes test accuracy, train time, parameter count, and an approximate effective LOC (lines of code, measured by introspecting key functions).
Colab: upload any notebook, run all.
Local conda env (CPU baseline):
conda create -n mnist-cnn python=3.11 -c conda-forge -y
conda activate mnist-cnn
conda install numpy matplotlib scikit-learn scikeras tensorflow pytorch torchvision -c conda-forge -yGPU users should install vendor wheels:
- PyTorch (CUDA): see
https://pytorch.org/get-started/locally/and pick the--index-urlfor your CUDA version.- TensorFlow (CUDA): install a build matching your CUDA/cuDNN.
- Apple M‑series (MPS): recent PyTorch supports
mps; TensorFlow uses the metal plugin on macOS.
# On remote
conda activate mnist-cnn
jupyter lab --no-browser --port 8890
# On your laptop
ssh -L 8890:localhost:8890 youruser@remote.host
# Then open http://localhost:8890PyTorch: the notebooks auto-detect cuda → mps → cpu:
device = torch.device("cuda" if torch.cuda.is_available() else ("mps" if torch.backends.mps.is_available() else "cpu"))TensorFlow / Keras:
import tensorflow as tf
tf.config.list_physical_devices() # shows CPU/GPU/MPSIf multiple GPUs exist, you can select visibility by CUDA_VISIBLE_DEVICES=0 python ... (PyTorch & TF).
GradientTape etc.?artifacts/*_metrics.json files.numpy and framework seeds if you need bitwise‑stable results.Enjoy!