Reference / API reference / dorothy / dorothy.data / dorothy.data.augmentation
dorothy.data.augmentation¶
Training augmentations that mask labels and input spectra.
DynamicLabelMasking: hierarchical label masking.DynamicInputMasking: hierarchical input masking.
Each draws its random numbers from its own generators, seeded by its
seed argument, and leaves the global numpy and torch generators untouched.
Equal seeds give equal masks on the same device; torch draws differ between
CPU and CUDA.
Classes
|
Training augmentation that randomly masks input spectra hierarchically. |
|
Training augmentation that randomly masks labels hierarchically. |
- class dorothy.data.augmentation.DynamicLabelMasking(p_labelset_min=0.3, p_labelset_max=1.0, p_label_min=0.3, p_label_max=1.0, seed=None)[source]¶
Bases:
objectTraining augmentation that randomly masks labels hierarchically.
This augmentation implements a two-level hierarchical masking scheme: 1. Labelset level: Which label sources (apogee, galah, etc.) to include 2. Label level: Which parameters (teff, logg, fe_h, etc.) within each set
All probabilities are sampled fresh per batch from configurable uniform ranges to ensure the model sees diverse masking conditions during training.
For each star, one valid labelset and one valid label per labelset are always kept. Stars without a valid label are unchanged.
- p_labelset_min¶
Minimum probability of keeping each labelset.
- p_labelset_max¶
Maximum probability of keeping each labelset.
- p_label_min¶
Minimum probability of keeping each label.
- p_label_max¶
Maximum probability of keeping each label.
- seed¶
Seed of the random draws, or None.
Examples
>>> masking = DynamicLabelMasking(p_label_min=0.3, p_label_max=1.0) >>> y_masked = masking(y_batch) # y has shape (batch, 3, n_params)
- class dorothy.data.augmentation.DynamicInputMasking(p_survey_min=0.3, p_survey_max=1.0, f_min_override=None, f_max=0.5, p_block_min=0.3, p_block_max=1.0, seed=None)[source]¶
Bases:
objectTraining augmentation that randomly masks input spectra hierarchically.
This augmentation implements a two-level hierarchical masking scheme: 1. Survey level: Which surveys to include (for multi-survey training) 2. Block level: Which wavelength blocks within each kept survey
Block sizes are sampled log-uniformly per batch to explore all scales from single pixels up to large spectral regions. All probabilities are sampled fresh per batch from configurable uniform ranges.
For each star, one valid survey and one valid block per survey are always kept. Stars without a valid pixel are unchanged. A dropped block or survey has flux, error and mask zeroed.
- p_survey_min¶
Minimum probability of keeping each survey.
- p_survey_max¶
Maximum probability of keeping each survey.
- f_min_override¶
Optional override for minimum block size fraction.
- f_max¶
Maximum block size as fraction of spectrum.
- p_block_min¶
Minimum probability of keeping each block.
- p_block_max¶
Maximum probability of keeping each block.
- seed¶
Seed of the random draws, or None.
Examples
>>> masking = DynamicInputMasking(p_block_min=0.3, p_block_max=1.0) >>> X_masked = masking(X_batch, n_wavelengths={"boss": 4506, "desi": 7650})