Skip to content

CLI reference

class-e is one flat command line with nine commands. Run class-e COMMAND --help for the full flag list.

Command Purpose
generate compute training and test sets with CLASS
merge merge the chunks of a design
status progress of chunked generation
train fit emulators and save a bundle
evaluate accuracy report of a bundle on a test set
info describe a bundle
sample bundle preflight and single-point prediction
stitch join bundles covering adjacent \(\ell\) ranges
inspect dataset notebook (needs the ui extra)

Most commands read a YAML configuration; --set KEY=VALUE overrides any value with a dotted path.

generate

class-e generate configs/lcdm.yaml -N 100 -o TT -o TE -o EE
class-e generate configs/w0wacdm.yaml --workers 2 --threads 4
class-e generate configs/ede-axiclass.yaml --classy ~/github/AxiCLASS
class-e generate configs/w0wacdm.yaml --slurm --submit
Flag Meaning
--design NAME one design of samples.designs (default: all)
--out PATH output file of one design (with --chunk: directory of the parts)
-N, --N number of cosmologies
-m, --method sobol (use \(N = 2^m\)), lhc, lhs, cov
--cov PATH covariance matrix for cov (implies it)
--seed design seed (overrides samples.seed)
-o, --observable observable to compute, repeatable
--lmin, --lmax, --kmin, --kmax multipole range and \(P(k)\) grid [h/Mpc]
--workers chunks computed at once (an integer or auto)
--threads OpenMP threads per CLASS run
--n-chunks, --chunk split a design; compute one chunk
--checkpoint-every checkpoint frequency in points
--classy PATH CLASS build; default $CLASS_E_CLASSY, then theory.classy.path, then the installed classy (details)
--no-isolate compute in this process (debugging)
--slurm, --submit write, and optionally submit, SLURM jobs
-d, --dry-run print the settings and exit
-f, --force overwrite without asking
-i, --interactive, -e, --edit Marimo notebook (edit mode)

Output is .npz (format v2) plus a .meta.json sidecar, see Datasets and bundles.

merge

class-e merge data/toy/parts/toy_train_N256_s0 -o data/toy/data_train.npz

PREFIX is everything before .partXXXofYYY.npz. --max-failure-fraction sets the accepted CLASS failures over the whole design.

status

class-e status data/toy/parts [--json]

Finished chunks, checkpointed points, failures and running chunks per design.

train

class-e train configs/toy-pipeline.yaml
class-e train --dataset data.npz --backend jax --N-PCA 20 --out models/lcdm.cemu
Flag Meaning
--dataset, --test-dataset, --test-fraction training set; separate test set, or the held-out fraction (0.2)
--backend sklearn (default), jax or vae
--N-PCA PCA components (latent size for vae; 0 disables PCA, sklearn only)
--kernel, --ard / --no-ard GP kernel (rbf, matern32, matern52, rq), one length scale per input
--optimizer, --n-restarts auto, lbfgs or adam (JAX and VAE); random restarts
--log-space / --no-log-space emulate \(\log Y\)
--standardize / --no-standardize standardize inputs, see Backends
--input NAME=EXPR train on an expression of the parameters, repeatable
--out PATH save the .cemu bundle
--learning-curve N1,N2,... instead of training a bundle: test accuracy when training on the first N points
--pca-curve K1,K2,... instead of training a bundle: test accuracy per number of PCA components
--plots DIR with the curves: write the figure (needs class-e[plot]) and the numbers (JSON)
--x64 / --no-x64 float64 for JAX backends
-i, --interactive, -e, --edit Marimo notebook (needs the ui extra)

evaluate

class-e evaluate bundles/toy.cemu --config configs/toy-pipeline.yaml \
    --plots plots/toy --report plots/toy.html
class-e evaluate model.cemu -t test.npz --ell-ranges 2,30,500,2500 --by "w0 + wa:-3,-0.5,0"
Flag Meaning
-t, --test test set .npz
-c, --config pipeline YAML (its train.test_design and evaluate: section)
-o, --observable observables to evaluate, repeatable
--ell-ranges multipole range edges
--by "EXPR:E1,E2,..." errors per bin of a parameter expression
--worst N list the worst test points (default 5)
--json FILE, --report FILE JSON and self-contained HTML report
--plots DIR accuracy figures (needs class-e[plot])

CMB errors are in units of the cosmic variance, others are relative. --plots draws one figure per kind of observable: bands (CMB spectra against ℓ, in percent and in σ_CV), relative_bands (Hz, chi against 1+z, mPk against k) and scalars (H0, rs_drag, ... : the sorted relative error over the test points).

info

class-e info bundles/toy.cemu

Backend, compression, standardization and differentiability of each emulator. Without a path, models/emulators.cemu is used. A published emulator's name (class-e info lcdm@jax) is downloaded first; see Published emulators.

diff

class-e diff a.cemu lcdm@sklearn

Compares two bundles: their parameter space (fingerprint, CLASS build, settings), inputs, outputs (observables, backends, grids), training (dataset, metrics) and software versions. See Parameter space and CLASS build.

list, download, verify, lineage, reproduce, publish, registry, cache

class-e list [--installed | --remote] [--registry NAME] [--offline]
class-e download data lcdm [--split test] | --for lcdm@jax [--yes]
class-e lineage lcdm@jax
class-e reproduce lcdm@jax -o again.cemu
class-e publish FILE --space lcdm --registry-file registry.json [--to file|github|hf ...] [--dry-run]
class-e release --registry-file registry.json [--author "Family, Given"] [--sandbox] [--dry-run]
class-e search [-p NAME[=LO:HI]] [-o OBS] [--class NAME] [--kind emu|data] [--json]
class-e registry init DIR | check FILE [--download emu|all] [--reachable] [--strict]
class-e verify lcdm@jax
class-e download emu lcdm [--backend jax] [--version 2] [--registry official] [--force]
class-e registry list | add NAME LOCATION | remove NAME | refresh
class-e cache path | remove NAME | prune

Published emulators: what the registries list and what is downloaded, downloading one (checked against its sha256, kept in the cache), the registries read, and the cache. See Published emulators.

sample

class-e sample model.cemu -o TT -p h=0.674 -p omega_b=0.0224 -p omega_cdm=0.12

A preflight, not a sampler: it validates a bundle and optionally predicts a single point (-p NAME=VALUE, repeated). Posterior sampling is not implemented in the CLI.

stitch

class-e stitch low.cemu high.cemu -o full.cemu --overlap 100

Joins bundles on adjacent \(\ell\) ranges, blending smoothly over the overlap (-f overwrites).

inspect

class-e inspect [-e]

Opens the dataset-inspection notebook.

Legacy pickles

info and sample refuse pickled emulators unless --allow-pickle is given: loading a pickle executes code from the file.