Skip to content

Commit

Permalink
Merge pull request #192 from resibots/fix_tut
Browse files Browse the repository at this point in the history
Minor tutorial fixes
  • Loading branch information
costashatz authored Oct 24, 2016
2 parents 228901c + 3141761 commit 98dd32e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
8 changes: 4 additions & 4 deletions docs/tutorials/basic_example.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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



Expand All @@ -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``.
Expand All @@ -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``: ::
Expand All @@ -76,4 +76,4 @@ Full ``main.cpp``:
.. literalinclude:: ../../src/tutorials/basic_example.cpp
:language: c++
:linenos:
:lines: 46-
:lines: 48-
16 changes: 8 additions & 8 deletions docs/tutorials/gp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
------------
Expand All @@ -23,14 +23,14 @@ We first create a basic GP with an Exponential kernel (``kernel::Exp<Params>``)
.. 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 :

Expand All @@ -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.

Expand All @@ -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
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/opt.rst
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,4 @@ Here is the full file.
.. literalinclude:: ../../src/tutorials/opt.cpp
:language: c++
:linenos:
:lines: 45-
:lines: 46-
6 changes: 3 additions & 3 deletions docs/tutorials/statistics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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-

0 comments on commit 98dd32e

Please sign in to comment.