geopfa.extrapolationΒΆ
exptrapolation.py - Gaussian Process Regression (GPR) for extrapolating values on a 2D grid over multiple Z slices.
This module provides functions for: - I/O and Data Handling: reading data into GeoDataFrames and saving/loading GPy models. - Pre-processing: preparing data for modeling (extracting slices, standardizing). - Modeling: building Gaussian Process models (with composite kernels) and making predictions. - Validation/Evaluation: assessing model performance and diagnostic tests on residuals. - Visualization: plotting residuals, uncertainty, and comparison of predictions vs true values.
Functions
|
Compute regression performance metrics and model diagnostics for a trained Gaussian Process model. |
|
Perform Gaussian Process-based extrapolation (or interpolation) to fill missing values in a GeoDataFrame at a specified Z slice. |
|
Backfill missing values in a GeoDataFrame at a specific Z slice using a precomputed 2D grid of fill-in predictions. |
|
Perform bootstrap-based residual diagnostic tests for Gaussian Process residuals. |
|
Build and train a Sparse Gaussian Process regression model using a globally stabilized multi-kernel combination (RBF + Matern32 + optional Bias/White). |
|
Construct a composite kernel consisting of optional components: RBF, Matern 3/2, long-scale RBF, Bias, and White noise kernels. |
|
Construct a Matern 3/2 kernel with ARD lengthscales constrained by the global radius of the dataset in standardized space. |
|
Construct an RBF kernel whose ARD lengthscale bounds are derived from the global radius of the standardized training coordinates. |
Identify kernel parameters whose optimized values lie at or extremely near their constrained lower or upper bounds. |
|
|
Compute a global spatial radius for standardized 2D coordinates. |
Compute dataset-agnostic kernel lengthscale bounds based on the global spatial radius of the standardized coordinate domain. |
|
|
Remove Z coordinates from 3D Point geometries in a GeoDataFrame, converting them into standard 2D Points. |
Estimate the unbiased sample variance of an array. |
|
|
Extract Gaussian noise variance bounds from a likelihood-parameter dictionary. |
|
Generate GP predictions, optionally converting back to original Y-units and optionally reshaping predictions into a 2D grid defined by x/y coordinates. |
|
Convert tidy (x, y, value) data into a rectangular grid and aligned meshgrids. |
|
Prepare all arrays needed for 2D Gaussian process interpolation. |
|
Load a serialized GPy model from disk using joblib. |
|
Plot side-by-side heatmaps comparing ground truth and predicted values on a shared color scale. |
|
Plot a 2D array Z using provided X-Y coordinates and a colorbar. |
|
Plot residual diagnostics: a histogram of residuals and a scatter plot of residuals versus predicted values. |
|
Prepare a tidy slice of (x, y, value) for an optional z-level filter. |
|
Recommend initialization parameters and a prior for the Gaussian likelihood (observation-noise variance) used in GPy models. |
|
Report (or warn about) model performance diagnostics. |
|
Save a GPy model to disk using joblib. |
|
Standardize coordinate arrays using the mean and standard deviation computed from the training coordinates. |
|
Update a GeoDataFrame with prediction values taken from a 2D grid. |