astra.contrib.thepayne.training

Module Contents

Functions

_prepare_data(training_spectra, training_labels, validation_spectra, validation_labels, label_names)
_whiten_labels(training_labels, validation_labels)
train(training_spectra, training_labels, validation_spectra, validation_labels, label_names, n_neurons=300, n_steps=100000.0, learning_rate=0.001, weight_decay=0, **kwargs) Train a neural network to emulate spectral models.
_train(training_flux, training_labels, validation_flux, validation_labels, label_names, n_neurons, n_steps, learning_rate, weight_decay, **kwargs)
load_training_data(path) read in the default Kurucz training spectra for APOGEE
astra.contrib.thepayne.training.CUDA_AVAILABLE = False
astra.contrib.thepayne.training.default_tensor_type
astra.contrib.thepayne.training._prepare_data(training_spectra, training_labels, validation_spectra, validation_labels, label_names)
astra.contrib.thepayne.training._whiten_labels(training_labels, validation_labels)
astra.contrib.thepayne.training.train(training_spectra, training_labels, validation_spectra, validation_labels, label_names, n_neurons=300, n_steps=100000.0, learning_rate=0.001, weight_decay=0, **kwargs)

Train a neural network to emulate spectral models.

Parameters:
  • training_spectra – A list of specutils.Spectrum1D spectra to use for training.
  • training_labels – A table containing the training labels to use. This must include the list of label names given in label_names.
  • validation_spectra – A list of specutils.Spectrum1D spectra to use for validation.
  • validation_labels – A table containing the validation labels to use. This must include the list of label names given in label_names.
  • n_neurons – [optional] The number of neurons to use per hidden layer in the network (default: 300).
  • n_steps – [optional] The maximum nubmer of steps to take until convergence (default: 1e5).
  • learning_rate – [optional] The step size to take for gradient descent (default: 0.001).
  • weight_decay – [optional] The weight decay (regularization) to apply to the model (default: 0).
Returns:

A three-length tuple containing the state, the model, and the optimizer. All information needed to reconstruct the model is saved in the state.

astra.contrib.thepayne.training._train(training_flux, training_labels, validation_flux, validation_labels, label_names, n_neurons, n_steps, learning_rate, weight_decay, **kwargs)
astra.contrib.thepayne.training.load_training_data(path)

read in the default Kurucz training spectra for APOGEE

Here we only consider 800 training spectra and 200 validation spectra for the tutorial (due to the GitHub upload limit); in practice, more training spectra will be better. The default neural networks included were trained using 10000 training spectra.

astra.contrib.thepayne.training.label_names = ['teff', 'logg', 'v_turb', 'c_h', 'n_h', 'o_h', 'na_h', 'mg_h', 'al_h', 'si_h', 'p_h', 's_h', 'k_h', 'ca_h', 'ti_h', 'v_h', 'cr_h', 'mn_h', 'fe_h', 'co_h', 'ni_h', 'cu_h', 'ge_h', 'c12_c13', 'v_macro', 'v_rad']