From 314176187ddb11fc48cbae1bec2db102c265d6b2 Mon Sep 17 00:00:00 2001 From: Konstantinos Chatzilygeroudis Date: Mon, 24 Oct 2016 13:28:22 +0200 Subject: [PATCH] Minor tutorial fixes --- docs/tutorials/basic_example.rst | 8 ++++---- docs/tutorials/gp.rst | 16 ++++++++-------- docs/tutorials/opt.rst | 2 +- docs/tutorials/statistics.rst | 6 +++--- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/docs/tutorials/basic_example.rst b/docs/tutorials/basic_example.rst index 895c36412c..5d29e3e223 100644 --- a/docs/tutorials/basic_example.rst +++ b/docs/tutorials/basic_example.rst @@ -41,7 +41,7 @@ To begin, the ``main`` file has to include the necessary files, and declare the .. literalinclude:: ../../src/tutorials/basic_example.cpp :language: c++ :linenos: - :lines: 47-93 + :lines: 55-94 @@ -52,7 +52,7 @@ Then, we have to define the evaluation function for the optimizer to call: .. literalinclude:: ../../src/tutorials/basic_example.cpp :language: c++ :linenos: - :lines: 95-108 + :lines: 95-109 It is required that the evaluation struct has the static members ``dim_in`` and ``dim_out``, specifying the input and output dimensions. Also, it should have the ``operator()`` expecting a ``const Eigen::VectorXd&`` of size ``dim_in``, and return another one, of size ``dim_out``. @@ -62,7 +62,7 @@ With this, we can declare the main function: .. literalinclude:: ../../src/tutorials/basic_example.cpp :language: c++ :linenos: - :lines: 109-119 + :lines: 111-120 Finally, from the root of limbo, run a build command, with the additional switch ``--exp myExp``: :: @@ -76,4 +76,4 @@ Full ``main.cpp``: .. literalinclude:: ../../src/tutorials/basic_example.cpp :language: c++ :linenos: - :lines: 46- + :lines: 48- diff --git a/docs/tutorials/gp.rst b/docs/tutorials/gp.rst index 223e2b2765..545e658af4 100644 --- a/docs/tutorials/gp.rst +++ b/docs/tutorials/gp.rst @@ -13,7 +13,7 @@ We assume that our samples are in a vector called ``samples`` and that our obser .. literalinclude:: ../../src/tutorials/gp.cpp :language: c++ :linenos: - :lines: 75-84 + :lines: 75-85 Basic usage ------------ @@ -23,14 +23,14 @@ We first create a basic GP with an Exponential kernel (``kernel::Exp``) .. literalinclude:: ../../src/tutorials/gp.cpp :language: c++ :linenos: - :lines: 58-62 + :lines: 60-63 The type of the GP is defined by the following lines: .. literalinclude:: ../../src/tutorials/gp.cpp :language: c++ :linenos: - :lines: 87-89 + :lines: 87-90 To use the GP, we need : @@ -40,7 +40,7 @@ To use the GP, we need : .. literalinclude:: ../../src/tutorials/gp.cpp :language: c++ :linenos: - :lines: 91-98 + :lines: 92-99 Here we assume that the noise is the same for all samples and that it is equal to 0.01. @@ -57,7 +57,7 @@ To visualize the predictions of the GP, we can query it for many points and reco .. literalinclude:: ../../src/tutorials/gp.cpp :language: c++ :linenos: - :lines: 101-111 + :lines: 101-112 Hyper-parameter optimization @@ -71,21 +71,21 @@ A new GP type is defined as follows: .. literalinclude:: ../../src/tutorials/gp.cpp :language: c++ :linenos: - :lines: 115-117 + :lines: 116-118 It uses the default values for the parameters of ``SquaredExpARD``: .. literalinclude:: ../../src/tutorials/gp.cpp :language: c++ :linenos: - :lines: 63-64 + :lines: 64-65 After calling the ``compute()`` method, the hyper-parameters can be optimized by calling the ``optimize_hyperparams()`` function. The GP does not need to be recomputed and we pass ``false`` for the last parameter in ``compute()`` as we do not need to compute the kernel matrix again (it will be recomputed in the hyper-parameters optimization). .. literalinclude:: ../../src/tutorials/gp.cpp :language: c++ :linenos: - :lines: 121-122 + :lines: 122-123 We can have a look at the difference between the two GPs: diff --git a/docs/tutorials/opt.rst b/docs/tutorials/opt.rst index 3a36d44f16..4c53f55634 100644 --- a/docs/tutorials/opt.rst +++ b/docs/tutorials/opt.rst @@ -70,4 +70,4 @@ Here is the full file. .. literalinclude:: ../../src/tutorials/opt.cpp :language: c++ :linenos: - :lines: 45- + :lines: 46- diff --git a/docs/tutorials/statistics.rst b/docs/tutorials/statistics.rst index a268592b52..f1d8203651 100644 --- a/docs/tutorials/statistics.rst +++ b/docs/tutorials/statistics.rst @@ -66,18 +66,18 @@ In order to configure the Bayesian optimizer to use our new statistics class, we .. literalinclude:: ../../src/tutorials/statistics.cpp :language: c++ :linenos: - :lines: 144-147 + :lines: 144-148 Then, we use it to define the optimizer: .. literalinclude:: ../../src/tutorials/statistics.cpp :language: c++ :linenos: - :lines: 150 + :lines: 151 The full source code is available in `src/tutorials/statistics.cpp` and reproduced here: .. literalinclude:: ../../src/tutorials/statistics.cpp :language: c++ :linenos: - :lines: 46- + :lines: 48-