This page’s code cells are executed live by Quarto every time the docs are built. q.model collects ML model utilities in two kinds of submodules:
Submodule
What it is
q.model.torch
framework adapter: PyTorch helpers (model summaries via torchinfo today)
q.model.selection
framework-agnostic, leakage-aware CV splitters for time series (planned)
Framework-specific adapters each get their own submodule (q.model.torch today; others only once actually needed), while framework-agnostic helpers sit as flat siblings.
PyTorch model summaries: q.model.torch.summary
A thin wrapper over torchinfo: a Keras-style layer-by-layer summary with output shapes, parameter counts, and estimated memory usage — handy for sanity-checking an architecture before training. Pass input_size=(batch, ...) or a real batch via input_data=:
import torch.nn as nnimport qrt as qnet = nn.Sequential( nn.Linear(10, 64), nn.ReLU(), nn.Linear(64, 32), nn.ReLU(), nn.Linear(32, 1),)q.model.torch.summary(net, input_size=(32, 10))
Leakage-aware cross-validation splitters for time-series data — walk-forward (expanding-window) splits, purged K-fold, and embargo periods — named after scikit-learn’s model_selection:
for train_idx, test_idx in q.model.selection.timeseries_split(X, n_splits=5, embargo="5D"): ...
timeseries_split is a placeholder today; follow progress on the Roadmap.