How k-onoue/variational-tpr works
Project Type and Purpose
• This is a Python research library and experiment orchestration toolkit for “Tractable Variational Student-t Process Regression.”
• It provides:
• Core implementations of dense and sparse Student-t process regression models (in src/student)
• Experiment definitions (in experiments/*.py)
• Shell scripts to launch those experiments under Slurm or locally.
• Use case: run hyperparameter-configurable GPR/TPR experiments on CPU/GPU and collect results.
File-Structure Analysis
• Top-level:
.gitignore, README.md, requirements.txt, pyproject.toml → project metadata and packaging
src/student → core ML library modules (gpr, kernels, priors, tpr, tang, xu, utils, constants)
experiments → Python scripts defining variants of dense_v{1..7}.py and sparse_v{1..6}.py
scripts → bash wrappers (run_dense.sh, run_dense_ablation.sh, run_sparse.sh, run_sparse_ablation.sh)
• Patterns:
• “src/student” follows a modular ML-library pattern.
• experiments folder holds high-level experiment scenarios.
• scripts folder defines orchestration on HPC/Slurm.
• Deployment/config: pyproject.toml for packaging, requirements.txt for dependencies, .python-version for pyenv.
README Insights
• Describes installation, directory layout, usage of hyper_settings dictionary for model configuration, and how to run experiments.
• Emphasizes two experiment modes: dense vs sparse (with GPU for sparse).
a. Main Components
• User/HPC Scheduler (Slurm)
• Orchestration Scripts (bash in scripts/)
• Experiment Definitions (Python in experiments/)
• Core Library (src/student modules)
• Data (datasets input, logs/, results/ output)
• External Dependencies (Python 3.12, pip packages, GPU/CPU resources)
b. Relationships & Interactions
• User invokes a script (e.g., run_sparse.sh)
→ Slurm schedules job on allocated CPU/GPU
→ Script calls appropriate experiments/*.py
→ Each experiment imports src/student to build and train a model
→ Model leverages kernels.py, priors.py, gpr.py, tpr.py, tang.py, xu.py, utils.py
→ Outputs (metrics, logs, serialized models) are written to logs/ and results/
c. Architectural Patterns
• Modular library-in-src pattern
• CLI orchestration via shell wrappers
• Experiment-per-script pattern for reproducibility
• Separation of concerns: hyperparameter configuration (dictionary), core math code, experiment definitions, orchestration
d. Key Technologies
• Python 3.12 environment managed via pyenv & venv
• Slurm job scheduler integration via bash scripts
• Numeric libraries from requirements.txt (e.g., torch, numpy, etc.)
• GPU acceleration for sparse models (NVIDIA A100)