~ubuntu-branches/ubuntu/utopic/deap/utopic-proposed

« back to all changes in this revision

Viewing changes to doc/tutorials/advanced/benchmarking.rst

  • Committer: Package Import Robot
  • Author(s): Daniel Stender, Miriam Ruiz, Daniel Stender, Jakub Wilk
  • Date: 2014-07-06 00:03:41 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20140706000341-s7gij1ki3d8xz6t9
Tags: 1.0.1-1
[ Miriam Ruiz ]
* New Upstream Release. Closes: #675200
* Upgraded Standards-Version from 3.9.2 to 3.9.5
* Switched to dh_python2
* Upgraded debian/compat to 9
* Added build-arch and build-indep targets to debian/rules
* Using awk to remove connection from the documentation to google analytics
* Using jquery.js and underscore.js from libjs-jquery and libjs-underscore
* Added patches/doc.patch

[ Daniel Stender ]
* deb/control:
  + Added myself to Uploaders.
  + Added version to b-p on python-all.
  + Updated Homepage.
  + Wrapped and sorted.
* deb/copyright:
  + Changed copyright file towards DEP-5.
  + Updated Source URI (project source moved to Github).
  + Added email addresses for copyright holders.
  + Dropped license for eap/toolbox.py (not included anymore).
  + Extended copyrights to 2014.
  + Added myself to copyrights for deb/*.
  + Specified license location.
* Added watch file [initial version by Jackson Doak].

[ Jakub Wilk ]
* Use canonical URIs for Vcs-* fields.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Benchmarking Against the Bests (BBOB)
 
2
=====================================
 
3
 
 
4
Once you've created your own algorithm, the structure of DEAP allows you to
 
5
benchmark it against the best algorithms very easily. The interface of the
 
6
`Black-Box Optimization Benchmark <http://coco.gforge.inria.fr/>`_ (BBOB) is
 
7
compatible with the toolbox. In fact, once your new algorithm is encapsulated in
 
8
a main function, there is almost nothing else to do on DEAP's side. This tutorial
 
9
will review the essential steps to bring everything to work with the very basic
 
10
:ref:`one-fifth`.
 
11
 
 
12
Preparing the Algorithm
 
13
-----------------------
 
14
 
 
15
The BBOB makes use of many continuous functions on which the algorithm will be
 
16
tested. These functions are given as an argument to the algorithm. The toolbox
 
17
shall thus register the evaluation in the main function.
 
18
 
 
19
The evaluation functions provided by BBOB return a fitness as a single value.
 
20
The first step is to put each fitness in its own tuple, as required by DEAP's
 
21
philosophy on single objective optimization. We will use a decorator for this.
 
22
 
 
23
.. literalinclude:: ../../../examples/bbob.py
 
24
   :pyobject: tupleize
 
25
 
 
26
The algorithm is encapsulated in a main function that receives four arguments:
 
27
the evaluation function, the dimensionality of the problem, the maximum number
 
28
of evaluations and the target value to reach. As stated earlier, the toolbox is
 
29
initialized in the main function with the :func:`update` function (described in
 
30
the example) and the evaluation function received, which is decorated by our
 
31
tuple-izer.
 
32
 
 
33
Then, the target fitness value is encapsulated in a :class:`FitnessMin` object
 
34
so that we can easily compare the individuals with it. The last step is to
 
35
define the algorithm, which is explained in the :ref:`one-fifth` example.
 
36
 
 
37
.. literalinclude:: ../../../examples/bbob.py
 
38
   :pyobject: main
 
39
 
 
40
Running the Benchmark
 
41
---------------------
 
42
 
 
43
Now that the algorithm is ready, it is time to run it under the BBOB. The
 
44
following code is taken from the BBOB example with added comments. The
 
45
:mod:`fgeneric` module provides a :class:`LoggingFunction`, which take care of
 
46
outputting all necessary data to compare the tested algorithm with the other
 
47
ones published and to be published.
 
48
 
 
49
This logger contains the current problem instance and provides the problem
 
50
target. Since it is responsible of logging each evaluation function call, it is
 
51
not even needed to save the best individual found by our algorithm (call to the
 
52
:func:`main` function). The single line that is related to the provided
 
53
algorithm in the call to the :func:`main` function.
 
54
 
 
55
.. literalinclude:: ../../../examples/bbob.py
 
56
   :lines: 26,27,28,90-137
 
57
 
 
58
Once these experiments are done, the data contained in the :file:`ouput`
 
59
directory can be used to build the results document. See the `BBOB
 
60
<http://coco.gforge.inria.fr/>`_ web site on how to build the document.
 
61
 
 
62
The complete example is available in the file :example:`bbob`.