swiftemulator.emulators.multi_gaussian_process module
A gaussian process emulator that uses _multiple_ internal emulators to better predict functions that contain a ‘break’.
- class swiftemulator.emulators.multi_gaussian_process.MultipleGaussianProcessEmulator(kernel: Optional[Kernel] = None, mean_model: Optional[MeanModel] = None, independent_regions: Optional[List[List[float]]] = [[None, None]])[source]
Bases:
BaseEmulatorGenerator for emulators for individual scaling relations, using multiple trained gaussian processes regression instances and linear models under the hood.
- Parameters:
kernel – The
georgekernel to use. The GPE here uses a copy of this instance. By default, this is theExpSquaredKernelin Georgegeorge.kernels.Kernel – The
georgekernel to use. The GPE here uses a copy of this instance. By default, this is theExpSquaredKernelin Georgeoptional – The
georgekernel to use. The GPE here uses a copy of this instance. By default, this is theExpSquaredKernelin Georgemean_model – A mean model conforming to the
swiftemulatormean model protocol (several pre-made models are available in theswiftemulator.mean_modelsmodule).MeanModel – A mean model conforming to the
swiftemulatormean model protocol (several pre-made models are available in theswiftemulator.mean_modelsmodule).optional – A mean model conforming to the
swiftemulatormean model protocol (several pre-made models are available in theswiftemulator.mean_modelsmodule).independent_regions – The regions over which to construct independent emulators. None can be used in the first and last element to specify there are no boundaries to overlap. Must be monotonically increasing. Overlaps between regions are allowed and predicted values will be a weighted linear combination of both. For example, you could use
[[None, 1.0], [0.7, 2.0], [1.7, None]]for data that ran from 0.0 to 3.0 in the independent variable. Regions should not overlap more than once. This isn’t checked, but will break the code.List[List[float]] – The regions over which to construct independent emulators. None can be used in the first and last element to specify there are no boundaries to overlap. Must be monotonically increasing. Overlaps between regions are allowed and predicted values will be a weighted linear combination of both. For example, you could use
[[None, 1.0], [0.7, 2.0], [1.7, None]]for data that ran from 0.0 to 3.0 in the independent variable. Regions should not overlap more than once. This isn’t checked, but will break the code.
- kernel: Optional[Kernel]
- independent_regions: Optional[List[List[float]]]
- model_specification: Optional[ModelSpecification] = None
- model_parameters: Optional[ModelParameters] = None
- model_values: Optional[ModelValues] = None
- model_values_regions: Optional[List[ModelValues]] = None
- emulators: Optional[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.
np.array – Independent continuous variables to evaluate the emulator at.
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.
Notes
This will use the originally defined regions and overlaps will be calculated by using the weighted linear sum corresponding to the independent variable’s distance to the adjacent boundary. The errors use a weighted square sum.