Concepts
Held-out uncertainty
A model fitted to training spectra carries estimation error in its sample mean and covariance, which widens the standardized residuals of held-out spectra by a closed-form finite-sample factor .
Held-out and in-sample spectra
Section titled “Held-out and in-sample spectra”A held-out spectrum is a spectrum that the model was not fitted to, such as a spectrum that you repair. Its residuals include the error of the estimated mean and covariance. A training spectrum is different: it helped to fit the model, so the model leans toward it, and its in-sample residuals are smaller. The figure shows both:
training spectra per pixel, Ns / npix (log scale)
- held-out spectra
- training spectra
- square root of the mean finite-sample factor
The points show the RMS of the pixelwise z, with nguard 20, for models of 100 pixels fitted to Ns exactly Gaussian simulated spectra. Each point averages 10 training sets, and the held-out points use the same 2000 other spectra. At Ns = 2 npix the held-out RMS is 1.486, and at 20 npix it is 1.032. The training spectra stay near 1.
With few training spectra per pixel, the z-scores of held-out spectra are much wider than 1. A threshold of 5 on such z-scores then flags far more pixels than a Gaussian distribution would. With many training spectra per pixel, the effect becomes small.
The finite-sample factor
Section titled “The finite-sample factor”The finite-sample factor states the widening exactly. A model predicts pixels of a held-out spectrum from conditioning pixels. Let be the χ² of those pixels, with their full conditional covariance. Then , with
The factor grows as approaches . It is not defined where
. For one pixel of a pixelwise prediction, and
is the number of pixels outside the guard window. The curve of the figure is the
square root of the mean of over the pixels, and it matches the points.
What GSPICE needs gives for a spectrum of
200 pixels, and Why 1500 pixels for the
survey of the worked example. gspice.finite_sample_factor()
computes .
Conditions
Section titled “Conditions”is exact under five conditions:
- The model is dense and mean-centered: no low rank and no constant center.
- The model is unweighted and not noise-aware.
- The working vectors are independent draws from one Gaussian distribution.
- The pixel sets do not depend on the data.
- counts the conditioning pixels only. Guard and ignored pixels do not count.
Condition 3 fails for scaled spectra with a spread of S/N, which are a mixture of
Gaussian distributions. Condition 4 fails for
gspice.repair(), whose replaced and ignored
pixels depend on the z-scores. A model of another kind has no derived factor and
reports 1, although its held-out residuals are wider too.
Calibration measures the widening on your
own held-out spectra.
inflate
Section titled “inflate”inflate=True corrects the predicted uncertainty for this widening. pixelwise,
infill and repair then multiply each conditional variance and covariance by
. Here counts the training spectra of the S/N bin of the
spectrum, and the conditioning pixels of the prediction. The deviation of each
draw from the conditional mean grows by the
square root of that factor.
The factor of one pixel, , calibrates every fixed linear combination of the
predicted pixels, such as the flux in a band. The joint χ² of pixels needs
instead, which is larger. inflate=True raises a ValueError for
a model without a derived factor, and where is not defined.
Find outliers and
Fill known bad pixels show the
effect on simulated spectra.
Repaired.fs
Section titled “Repaired.fs”Repaired.fs holds the factor that keeps chi2 / (dof * fs) at the mean 1 for
held-out Gaussian spectra, with or without inflate:
- without
inflate, ; - with
inflate=True, , becausechi2already uses the inflated covariance.
It is NaN where is not defined, and 1 for a model without a derived factor.
held-out spectrum
A spectrum that the model was not fitted to.
in-sample
Computed on the training spectra of the model, as the z-scores of the clipping passes
of fit are.
finite-sample factor
: the factor by which the error of an estimated mean and covariance widens the residuals of a held-out spectrum, (Held-out uncertainty).
conditioning pixels
The pixels whose values a prediction uses, : all pixels outside . The paper calls this set , and counts it.
χ²
One number that compares several observed values with their prediction:
, with the residuals and their conditional covariance.
It counts correlated errors once. Its number of degrees of freedom is the number of
values, Repaired.dof (Prediction).
draw
A random sample of the replaced pixels from their conditional distribution, in
Repaired.draws. It scatters like an observed spectrum, unlike the conditional mean.