Contribute / Shared definitions
Shared definitions¶
This page lists the steps that training, evaluation and prediction must do the same way. Each has one implementation. To change one, edit that implementation; never repeat it in a caller.
The definitions¶
Definition |
Implementation |
Callers |
|---|---|---|
Which stars are used, and the split |
|
|
Spectrum preprocessing |
|
Every catalogue loader, |
Label normalization |
Training, evaluation |
|
Predicted scatter |
The loss, validation, evaluation, prediction, saliency |
|
Calibration of the predicted scatter |
Evaluation, prediction |
|
Model forward pass per label source |
Training, validation, evaluation |
Data formats¶
Every function passes data in these shapes (Preprocessing defines them).
Array |
Shape |
Channels |
|---|---|---|
Spectra |
|
flux, \(\rho = \ln(1 + 1/\sigma)\), mask |
Labels |
|
values, errors, mask |
Model output |
|
\(\mu\), \(\ln s\), in normalized units |
A masked entry can hold any value, NaN and infinity included. Select with the mask (
torch.where, boolean indexing) before arithmetic; never multiply by the mask.The parameter names, and their number, come from the catalogue’s
parameter_namesattribute. Never assume 11 parameters.Random numbers come from the configured
seed:numpy.random.RandomState(seed)for the split, and seeded generators for augmentation and initialization.
The test that guards them¶
tests/test_end_to_end.py checks that evaluation reproduces the validation
metrics of training for every data layout. A definition that
drifts between two callers fails this test.