Software

Neural-network playground

What you are looking at
Epoch
0
Validation RMSE
… dex

Loading 4,000 stars (0.5 MB).

Layers, units and activation build a new network; the other three apply at once.

The network positive weightnegative weight
Mean squared error per epoch trainingvalidation
Estimate against catalogue [M/H]800 validation stars
The star being followed, as the network receives it

Scaled so that 0 is the training average and 1 its spread. Faded bars lie beyond the coefficients the catalogue lists as relevant for this star.

Spectra of the three example giants

Flux relative to each star's mean.

A multilayer perceptron maps the first 24 Hermite coefficients of each star's Gaia DR3 BP and RP spectra, divided by its brightness, to its GSP-Spec metallicity [M/H]; it learns from 3,200 stars and is checked on 800 that it never trains on.

What you are looking at

The diagram draws the network. A star enters as 48 numbers, its BP coefficients in the upper band and its RP coefficients in the lower one, and passes through the hidden layers to a single output, the estimated [M/H].

Each line is a weight, coloured by its sign and drawn thicker the larger it is; to stay legible, the diagram draws at most 400 lines, chosen by the size of their weights. Unless your device asks for reduced motion, dots trace the followed star through the layers, and each node's colour shows how strongly it responds to that star.

The error curve gives the mean squared difference between the network's estimates and the GSP-Spec values after each epoch, one pass through the 3,200 training stars. The validation stars never adjust the weights, so their curve shows how well the network generalises. When the validation curve flattens or turns upwards while the training curve keeps falling, the network has begun to fit noise in its training stars; an L2 penalty, which pulls the weights towards zero, usually delays that.

The scatter plot sets each validation star's estimate against its GSP-Spec value, which comes from a separate instrument on Gaia, the Radial Velocity Spectrometer. A perfect estimate would sit on the diagonal, and colour gives the star's temperature. Select a point to follow that star through the network.

Train runs until you pause it, for at most 2,000 epochs, and Step trains for one epoch. Reset starts again from the same initial weights, so two runs that differ in one setting can be compared. Changing the layers, the units or the activation builds a new network, while the learning rate, the batch size and the L2 penalty take effect at once.

The bars are the followed star's 48 input numbers. The curves are the spectra of three red giants of similar temperature and colour. Absorption lines of metals crowd the blue end of a spectrum, and the giant with [M/H] +0.25 has less blue light, relative to its mean, than the other two.

Data and credits

This page is a teaching demonstration. Andrae, Rix and Chandra (2023, ApJS 267, 8) estimated metallicities from the same Gaia spectra for about 175 million stars, with a different method and a much larger training set.

The 4,000 stars are the first, in the random order that Gaia DR3 provides, whose GSP-Spec parameters raise no warning in the first 13 quality flags (Recio-Blanco et al. 2023). That cut leaves few metal-poor stars, so [M/H] here runs only from −0.88 to +0.73 dex. The labels are the published catalogue values, with no calibration applied, and the split into 3,200 training and 800 validation stars is fixed.

The labels and the selection come from the ESA Gaia archive. The XP coefficients come from the same Gaia DR3 table at the Gaia@AIP data centre, because the ESA archive serves that table only through its DataLink service. Each star's coefficients are divided by the sum of its first BP and first RP coefficient, a measure of its brightness, and the first 24 of the 55 in each band are kept.

This page uses data from the European Space Agency mission Gaia (Gaia Collaboration, Vallenari et al. 2023, A&A 674, A1), processed by the Gaia Data Processing and Analysis Consortium (DPAC). The XP spectra are described by De Angeli et al. (2023, A&A 674, A2) and Montegriffo et al. (2023, A&A 674, A3), and the GSP-Spec parameters by Recio-Blanco et al. (2023, A&A 674, A29).

The example spectra were sampled with GaiaXPy, developed by members of DPAC. Gaia data are © ESA/Gaia/DPAC and released under CC BY-SA 3.0 IGO, and the derived files below are shared under the same licence.

Download the data (0.5 MB), its header and its provenance, which records the queries, their dates and the cuts. Training runs in your browser, and nothing you do here is sent anywhere.