pykrige.rk.RegressionKriging

class pykrige.rk.RegressionKriging(regression_model=SVR(C=1.0, cache_size=200, coef0=0.0, degree=3, epsilon=0.1, gamma='auto', kernel='rbf', max_iter=-1, shrinking=True, tol=0.001, verbose=False), method='ordinary', variogram_model='linear', n_closest_points=10, nlags=6, weight=False, verbose=False)[source]

This is an implementation of Regression-Kriging as described here: https://en.wikipedia.org/wiki/Regression-Kriging

__init__(regression_model=SVR(C=1.0, cache_size=200, coef0=0.0, degree=3, epsilon=0.1, gamma='auto', kernel='rbf', max_iter=-1, shrinking=True, tol=0.001, verbose=False), method='ordinary', variogram_model='linear', n_closest_points=10, nlags=6, weight=False, verbose=False)[source]
Parameters:
  • regression_model (machine learning model instance from sklearn) –
  • method (str, optional) – type of kriging to be performed
  • variogram_model (str, optional) – variogram model to be used during Kriging
  • n_closest_points (int) – number of closest points to be used during Ordinary Kriging
  • nlags (int) – see OK/UK class description
  • weight (bool) – see OK/UK class description
  • verbose (bool) – see OK/UK class description

Methods

__init__([regression_model, cache_size, …])
param regression_model:
 
fit(p, x, y) fit the regression method and also Krige the residual
krige_residual(x)
param x:ndarray of (x, y) points. Needs to be a (Ns, 2) array
predict(p, x)
param p:(Ns, d) array of predictor variables (Ns samples, d dimensions)
score(p, x, y[, sample_weight]) Overloading default regression score method
fit(p, x, y)[source]

fit the regression method and also Krige the residual

Parameters:
  • p (ndarray) – (Ns, d) array of predictor variables (Ns samples, d dimensions) for regression
  • x (ndarray) – ndarray of (x, y) points. Needs to be a (Ns, 2) array corresponding to the lon/lat, for example 2d regression kriging. array of Points, (x, y, z) pairs of shape (N, 3) for 3d kriging
  • y (ndarray) – array of targets (Ns, )
krige_residual(x)[source]
Parameters:x (ndarray) – ndarray of (x, y) points. Needs to be a (Ns, 2) array corresponding to the lon/lat, for example.
Returns:residual – kriged residual values
Return type:ndarray
predict(p, x)[source]
Parameters:
  • p (ndarray) – (Ns, d) array of predictor variables (Ns samples, d dimensions) for regression
  • x (ndarray) – ndarray of (x, y) points. Needs to be a (Ns, 2) array corresponding to the lon/lat, for example. array of Points, (x, y, z) pairs of shape (N, 3) for 3d kriging
Returns:

pred – The expected value of ys for the query inputs, of shape (Ns,).

Return type:

ndarray

score(p, x, y, sample_weight=None)[source]

Overloading default regression score method

Parameters:
  • p (ndarray) – (Ns, d) array of predictor variables (Ns samples, d dimensions) for regression
  • x (ndarray) – ndarray of (x, y) points. Needs to be a (Ns, 2) array corresponding to the lon/lat, for example. array of Points, (x, y, z) pairs of shape (N, 3) for 3d kriging
  • y (ndarray) – array of targets (Ns, )