swiftemulator.emulators.gaussian_process_bins module

Gaussian Process Emulator using an emulator for each bins

class swiftemulator.emulators.gaussian_process_bins.GaussianProcessEmulatorBins(kernel: Optional[Kernel] = None, mean_model: Optional[MeanModel] = None)[source]

Bases: BaseEmulator

Generator for emulators for individual scaling relations. Uses a GP for each seperate bin.

Parameters:
  • kernel – The george kernel to use. The GPE here uses a copy of this instance. By default, this is the ExpSquaredKernel in George

  • george.kernels.Kernel – The george kernel to use. The GPE here uses a copy of this instance. By default, this is the ExpSquaredKernel in George

  • optional – The george kernel to use. The GPE here uses a copy of this instance. By default, this is the ExpSquaredKernel in George

  • mean_model – A mean model conforming to the swiftemulator mean model protocol (several pre-made models are available in the swiftemulator.mean_models module).

  • MeanModel – A mean model conforming to the swiftemulator mean model protocol (several pre-made models are available in the swiftemulator.mean_models module).

  • optional – A mean model conforming to the swiftemulator mean model protocol (several pre-made models are available in the swiftemulator.mean_models module).

kernel: Optional[Kernel]
mean_model: Optional[MeanModel]
model_specification: Optional[ModelSpecification] = None
model_parameters: Optional[ModelParameters] = None
model_values: Optional[ModelValues] = None
ordering: Optional[List[Hashable]] = None
parameter_order: Optional[List[str]] = None
independent_variables: Optional[array] = None
dependent_variables: Optional[array] = None
dependent_variable_errors: Optional[array] = None
n_bins: int = None
bin_model_values: List[Dict[str, array]] = None
bin_centers: List[float] = None
bin_gaussian_process: List[GP] = None
fit_model(model_specification: ModelSpecification, model_parameters: ModelParameters, model_values: ModelValues)[source]

Fits the gaussian process model, as determined by the initialiser variables of the class (i.e. the kernel and the mean model).

Parameters:
  • model_specification (ModelSpecification) – Full instance of the model specification.

  • model_parameters (ModelParameters) – Full instance of the model parameters.

  • model_values (ModelValues) – Full instance of the model values describing this individual scaling relation.

Notes

This method uses copies of the internal kernel and mean model objects, as those objects contain slightly unhelpful state information.

predict_values(independent: array, model_parameters: Dict[str, float]) array[source]

Predict values from the trained emulator contained within this object.

Parameters:
  • independent – Independent continuous variables to evaluate the emulator at. If the emulator is discrete, these are only allowed to be the discrete independent variables that the emulator was trained at (disregarding the additional ‘independent’ model parameters, below). These can be found in this object in the bin_centers attribute.

  • np.array – Independent continuous variables to evaluate the emulator at. If the emulator is discrete, these are only allowed to be the discrete independent variables that the emulator was trained at (disregarding the additional ‘independent’ model parameters, below). These can be found in this object in the bin_centers attribute.

  • model_parameters (Dict[str, float]) – The point in model parameter space to create predicted values at.

Returns:

  • dependent_predictions, np.array – Array of predictions, if the emulator is a function f, these are the predicted values of f(independent) evaluted at the position of the input model_parameters.

  • dependent_prediction_errors, np.array – Errors on the model predictions. For models where the errors are unconstrained, this is an array of zeroes.

Raises:

AttributeError – When the model has not been trained before trying to make a prediction, or when attempting to evaluate the model at disallowed independent variables.