--- myst: substitutions: macro: python: 1-7,14-80,84-92,95-137 cpp: 5-53,57-65,68-109,112 bloc1: python: 113-115,117 cpp: 85-87,89 bloc2: python: 125-127 cpp: 97-98 dedent: python: "" cpp: "4" --- # Macro "**modelerTestKriging.{{extension}}**" ## Objective The idea is to provide a simple example of a kriging usage, and an how to, to produce plots in one dimension to represent the results. This example is the one taken from {{metho}} that uses a very simple set of six points as training database: {{ "```{literalinclude} " + parent_dir + "/roottest/uranie/references/modeler/utf-1D-train.dat" + "\n" + ":language: none\n" + "```" }} The aim will be to get a kriging model that describes this dataset and to check its consistency over a certain number of points (here 100 points) which will be the testing database: {{ "```{literalinclude} " + parent_dir + "/roottest/uranie/references/modeler/utf-1D-test.dat" + "\n" + ":language: none\n" + "```" }} In this example, two different correlation functions are tested and the obtained results are compared at the end. ## Macro {{uranie}} {{ "```{literalinclude} " + parent_dir + "/roottest/uranie/doc/modeler/use_cases/" + language + "/modelerTestKriging." + extension + "\n" + ":language: " + language + "\n" + ":lines: " + macro[language] + "\n" + "```" }} The first function of this macro (called `PrintSolutions`) is a complex part that will not be detailed, used to represent the results. The macro itself starts by reading the training database and storing it in a dataserver. A `TGPBuilder` is created with the chosen correlation function and the hyper-parameters are estimation by an optimisation procedure in: {{ "```{literalinclude} " + parent_dir + "/roottest/uranie/doc/modeler/use_cases/" + language + "/modelerTestKriging." + extension + "\n" + ":language: " + language + "\n" + ":lines: " + bloc1[language] + "\n" + ":dedent: " + dedent[language] + "\n" + "```" }} The last line shows how to build and retrieve the newly created kriging object. Finally, this kriging model is tested against the training database, thanks to a `TLauncher2` object, as following: {{ "```{literalinclude} " + parent_dir + "/roottest/uranie/doc/modeler/use_cases/" + language + "/modelerTestKriging." + extension + "\n" + ":language: " + language + "\n" + ":lines: " + bloc2[language] + "\n" + ":dedent: " + dedent[language] + "\n" + "```" }} ## Graph {{ "```{figure} " + parent_dir + "/roottest/build/uranie/doc/modeler/use_cases/" + language + "/kriging/modelerTestKriging.png\n" + ":align: center\n" + ":name: use_cases_modelerTestKriging\n" + figure_scale + "\n" + "\n" + "Graph of the macro **\"modelerTestKriging." + extension + "\"**" + "\n" + "```" }}