The pysmo.kriging trains Ordinary Kriging models. Interpolating kriging models assume that the outputs ŷ ∈ ℝm × 1 are correlated and may be treated as a normally distributed stochastic process. For a set of input measurements X = {x1,x2,…,xm}; xi ∈ ℝn, the output ŷ is modeled as the sum of a mean (μ)$` and a Gaussian process error,
Kriging models assume that the errors in the outputs ϵ are correlated proportionally to the distance between corresponding points,
The hyperparameters of the Kriging model (μ,σ2,θ1,…,θn,τ1,…,τn) are selected such that the concentrated log likelihood function is maximized.
To generate a Kriging model with PySMO, the pysmo.kriging class is first initialized, and then the function training is called on the initialized object:
# Required imports
>>> from idaes.surrogates.pysmo import kriging
>>> import pandas as pd
# Load dataset from a csv file
>>> xy_data = pd.read_csv('data.csv', header=None, index_col=0)
# Initialize the KrigingModel class, extract the list of features and train the model
>>> krg_init = kriging.KrigingModel(xy_data, *kwargs)
>>> features = krg_init.get_feature_vector()
>>> krg_init.training()
- xy_data is a two-dimensional python data structure containing the input and output training data. The output values MUST be in the last column.
Optional Arguments
numerical_gradients: Whether or not numerical gradients should be used in training. This choice determines the algorithm used to solve the problem.
- True: The problem is solved with BFGS using central differencing with Δ = 10 − 6 to evaluate numerical gradients.
- False: The problem is solved with Basinhopping, a stochastic optimization algorithm.
regularization - Boolean option which determines whether or not regularization is considered during Kriging training. Default is True.
- When regularization is turned on, the resulting model is a regressing kriging model.
- When regularization is turned off, the resulting model is an interpolating kriging model.
The result of pysmo.kriging is a python object containing information about the optimal Kriging hyperparameters (μ,σ2,θ1,…,θn) and different error and quality-of-fit metrics such as the mean-squared-error (MSE) and the R2 coefficient-of-fit. A Pyomo expression can be generated from the object simply passing a list of variables into the function generate_expression:
# Create a python list from the headers of the dataset supplied for training
>>> list_vars = []
>>> for i in features.keys():
>>> list_vars.append(features[i])
# Pass list to generate_expression function to obtain a Pyomo expression as output
>>> print(krg_init.generate_expression(list_vars))
Similar to the pysmo.polynomial_regression module, the output of the generate_expression function can be passed into an IDAES or Pyomo module as a constraint, objective or expression.
Once a Kriging model has been trained, predictions for values at previously unsampled points x_unsampled can be evaluated by calling the predict_output() function on the unsampled points:
# Create a python list from the headers of the dataset supplied for training
>>> y_unsampled = kriging_init.predict_output(x_unsampled)
Further details about pysmo.kriging module may be found by consulting the examples or reading the paper [...]
idaes.surrogate.pysmo.kriging
idaes.surrogate.pysmo.kriging.KrigingModel
[1] Forrester et al.'s book "Engineering Design via Surrogate Modelling: A Practical Guide", https://onlinelibrary.wiley.com/doi/pdf/10.1002/9780470770801
[2] D. R. Jones, A taxonomy of global optimization methods based on response surfaces, Journal of Global Optimization, https://link.springer.com/article/10.1023%2FA%3A1012771025575