comet_maths.interpolation.interpolation.gaussian_process_regression#
- comet_maths.interpolation.interpolation.gaussian_process_regression(x_i: ndarray, y_i: ndarray, x: ndarray, u_y_i: ndarray | None = None, corr_y_i: ndarray | str | None = None, kernel: str | None = 'RBF', min_scale: float | None = 0.01, max_scale: float | None = 10000, extrapolate: str | None = 'extrapolate', return_uncertainties: bool | None = True, return_corr: bool | None = False, include_model_uncertainties: bool | None = True, add_model_error: bool | None = False, MCsteps: int | None = 100, parallel_cores: int | None = 4) ndarray [source]#
Function to perform interpolation using Gaussian process regression
- Parameters:
x_i – Independent variable quantity x (coordinate data of y_i)
y_i – measured variable quantity y (data to interpolate)
x – Independent variable quantity x for which we are trying to obtain the measurand y
u_y_i – uncertainties on y_i, defaults to None
corr_y_i – error correlation matrix (can be “rand” for random, “syst” for systematic, or a custom 2D error correlation matrix), defaults to None
kernel – kernel to be used in the gpr interpolation. Defaults to “RBF”.
min_scale – minimum bound on the scale parameter in the gaussian process regression. Defaults to 0.01
max_scale – maximum bound on the scale parameter in the gaussian process regression. Defaults to 100
extrapolate – extrapolation method, which can be set to “extrapolate” (in which case extrapolation is used using interpolation method defined in “method”), “nearest” (in which case nearest values are used for extrapolation), or “linear” (in which case linear extrapolation is used). Defaults to “extrapolate”.
return_uncertainties – Boolean to indicate whether interpolation uncertainties should be calculated and returned. Defaults to False
return_corr – Boolean to indicate whether interpolation error-correlation matrix should be calculated and returned. Defaults to False
include_model_uncertainties – Boolean to indicate whether model uncertainties should be added to output uncertainties to account for interpolation uncertainties. Not used for gpr. Defaults to True
add_model_error – Boolean to indicate whether model error should be added to interpolated values to account for interpolation errors (useful in Monte Carlo approaches). Defaults to False
MCsteps – number of MC iterations. Defaults to 100
parallel_cores – number of CPU to be used in parallel processing. Defaults to 4
- Returns:
The measurand y evaluated at the values x (interpolated data)