Refit a fgpm
model as described in a Xfgpm
object.
# S4 method for Xfgpm
[[(x, i)
A Xfgpm
object.
An integer giving the index of the model to refit. The models are in decreasing fit quality as assessed by the Leave-One-Out \(Q^2\).
The slot @model
returns the best fgpm
as
assessed in a Xfgm
model x
. So this model can be
expected to be close to the same as x[[1]]
. Yet due to
the refit, the two models x@model
and x[[1]]
can
differ, see the explanations in the Caution section.
While the syntax may suggest that the function
extracts a fitted fgpm
model, this not true. The
fgpm
model is refitted using the call that was used
when this model was assessed. The refitted fgpm
model
keeps the same structural parameters as the one assessed
(active variables, kernel, ...), but since the optimization
uses random initial values, the optimized hyper-parameters may
differ from those of the corresponding fgpm
in the
Xfgpm
object x
. As a result, the model can be
different and show a different LOO performance.
The modelDef
function to extract the
definition of a fgpm
model e.g., to evaluate it using new
data sIn
, fIn
and sOut
.
## see `?xm` to see how to recreate the pre-caclulated `Xfgpm` object `xm`.
xm[[2]]
#> ** Presampling...
#> ** Optimising hyperparameters...
#> iter 10 value 198.720727
#> final value 198.720727
#> converged
#> The function value is the negated log-likelihood
#> ** Hyperparameters done!
#>
#> Gaussian Process Model____________________________________
#> * Scalar inputs: 4
#> * Functional inputs: 2
#>
#> | Input | Orig. dim | Proj. dim | Basis | Distance |
#> |:-----:|:---------:|:---------:|:---------:|:----------:|
#> | F1 | 10 | 1 | PCA | L2_byindex |
#> | F2 | 22 | 3 | B-splines | L2_byindex |
#>
#> * Total data points: 32
#> * Trained with: 32
#> * Kernel type: gauss
#> * Convergence: 0
#> * NegLogLik: 198.7207
#> * Hyperparameters:
#> -> variance: 216872.9287
#> -> length-scale:
#> ls(X1): 2.0000
#> ls(X2): 2.0000
#> ls(X3): 1.2111
#> ls(X4): 2.0000
#> ls(F1): 3.6250
#> ls(F2): 1.3678
#> ls(F2): 2.0390
#> ls(F2): 1.1276
#> __________________________________________________________