13.6.11. Macro “modelerbuildGPWithAPriori.C

13.6.11.1. Objective

This macro is the one described in Deterministic trend and bayesian prior, that creates a gaussian process with a specific trend and an a priori knowledge on the mean and variance of the trend parameters.

13.6.11.2. Macro Uranie

    // Load observations
    TDataServer *tdsObs = new TDataServer("tdsObs", "observations");

    tdsObs->fileDataRead("utf_4D_train.dat");

    // Construct the GPBuilder
    TGPBuilder *gpb = new TGPBuilder(tdsObs,            // observations data
                    "x1:x2:x3:x4",     // list of input variables
                    "y",               // output variable
                    "matern3/2",       // name of the correlation function
                    "linear");         // trend defined by a keyword


    // Bayesian study
    Double_t meanPrior[5] = {0.0, 0.0, -1.0, 0.0, -0.1};
    Double_t covPrior[25] = {1e-4, 0.0 , 0.0 , 0.0 , 0.0 ,
                0.0 , 1e-4, 0.0 , 0.0 , 0.0 ,
                0.0 , 0.0 , 1e-4, 0.0 , 0.0 ,
                0.0 , 0.0 , 0.0 , 1e-4, 0.0 ,
                0.0 , 0.0 , 0.0 , 0.0 , 1e-4};
    gpb->setPriorData(meanPrior, covPrior);

    // Search for the optimal hyper-parameters
    gpb->findOptimalParameters("ReML",          // optimisation criterion
                  100,             // screening design size
                  "neldermead",    // optimisation algorithm
                  500);            // max. number of optimisation iterations

    // Construct the kriging model
    TKriging *krig = gpb->buildGP();

    // Display model information
    krig->printLog();

13.6.11.3. Console

This is the result of the last command:

.*******************************
** TKriging::printLog[]
*******************************
 Input Variables:      x1:x2:x3:x4
 Output Variable:      y
 Deterministic trend:  linear
 Trend parameters (5): [3.06586494e-05; 1.64887174e-05; -9.99986787e-01; 1.51959859e-05; -9.99877606e-02 ]
 Correlation function: URANIE::Modeler::TMatern32CorrFunction
 Correlation length:   normalised   (not normalised)
                       2.1450e+00 (2.1438e+00 )
                       1.9092e+00 (1.9090e+00 )
                       2.0062e+00 (2.0040e+00 )
                       8.4315e+00 (8.4390e+00 )

 Variance of the gaussian process:      155.533
 RMSE (by Leave One Out):               0.495448
 Q2:                                    0.852037
*******************************