MLPKriging::fit

Description

Fit an MLPKriging model to observations, jointly optimising MLP weights and GP hyper-parameters.

Usage

  • Python

    # mk = MLPKriging(hidden_dims=[...], kernel=...)
    mk.fit(y, X, regmodel = "constant", normalize = False,
           optim = "BFGS+Adam", objective = "LL", parameters = None)
    
  • R

    # mk <- MLPKriging(hidden_dims = c(...), kernel = ...)
    mk$fit(y, X, regmodel = "constant", normalize = FALSE,
           optim = "BFGS+Adam", objective = "LL", parameters = NULL)
    
  • Matlab/Octave

    % mk = MLPKriging(hidden_dims = [...], kernel = ...)
    mk.fit(y, X, regmodel = "constant", normalize = false, ...
           optim = "BFGS+Adam", objective = "LL", parameters = [])
    
  • Julia

    # mk = MLPKriging(hidden_dims=[32, 16], d_out=2, kernel="gauss")
    fit(mk, y, X, regmodel="constant", normalize=false,
        optim="BFGS+Adam", objective="LL", parameters=nothing)
    

Arguments

Argument

Description

y

Numeric vector of response values.

X

Numeric matrix of input design.

regmodel

Universal Kriging linear trend: "constant", "linear", "quadratic".

normalize

Logical. If TRUE both X and y are normalised to \([0, 1]\).

optim

Optimiser. "BFGS+Adam" (default), "BFGS" or "none".

objective

Objective function. Currently "LL" (Log-Likelihood).

parameters

Optional named list / dict: "max_iter_adam", "adam_lr", "max_iter_bfgs".

Details

See MLPKriging constructor for full details on the optimisation strategy. No return value — the MLPKriging object is modified in place.

Value

No return value. The MLPKriging object is modified in place.

Examples

f <- function(x) 1 - 1 / 2 * (sin(12 * x) / (1 + x) + 2 * cos(7 * x) * x^5 + 0.7)
X <- as.matrix(seq(0.05, 0.95, length.out = 10))
y <- f(X)

mk <- MLPKriging(
  y, X,
  hidden_dims = c(4L),
  d_out = 1L,
  activation = "tanh",
  kernel = "gauss",
  parameters = list(max_iter_adam = "20", max_iter_bfgs = "10")
)
cat("before refit\n")
print(mk)

mk$fit(y, X,
       parameters = list(max_iter_adam = "20", max_iter_bfgs = "10"))

cat("after refit\n")
print(mk)

Results

before refit
* MLPKriging
* data: 10x[0.05,0.95] -> 10x[0.163421,0.976851]
* trend constant (est.): -745.4
* variance (est.): 3.13668e+08
* covariance:
  * kernel: gauss
  * range (est.): 2.88992
  * warpings:
      joint: "mlp_joint(4,1,tanh)"    MLPJoint(1 -> 4 -> 1, 13 params)
  * total warp params: 13
  * fit:
    * objective: LL
    * optim: BFGS+Adam
after refit
* MLPKriging
* data: 10x[0.05,0.95] -> 10x[0.163421,0.976851]
* trend constant (est.): -745.4
* variance (est.): 3.13668e+08
* covariance:
  * kernel: gauss
  * range (est.): 2.88992
  * warpings:
      joint: "mlp_joint(4,1,tanh)"    MLPJoint(1 -> 4 -> 1, 13 params)
  * total warp params: 13
  * fit:
    * objective: LL
    * optim: BFGS+Adam