py_api.rst 2.47 KB
Newer Older
1
2
3
4
============
 Python API
============

5
This section includes information for using the Python API of ``bob.learn.boosting``.
6
7
8
9

Machines
........

10
The :py:mod:`bob.learn.boosting` module contains classifiers that can predict classes for given input value:
11

12
* :py:class:`bob.learn.boosting.BoostedMachine` : the strong classifier, which is a weighted combination of several machines of type :py:class:`bob.learn.boosting.WeakMachine`.
13

14
Weak machines might be:
15

16
17
* :py:class:`bob.learn.boosting.LUTMachine` : A weak machine that performs a classification by a look-up-table thresholding.
* :py:class:`bob.learn.boosting.StumpMachine` : A weak machine that performs classification by simple threshlding.
18

19
Theoretically, the strong classifier can consist of different types of weak classifiers, but usually all weak classifiers have the same type.
20
21


22
23
24
25
Trainers
........

Available trainers in :py:mod:`bob.learn.boosting` are:
26

27
28
* :py:class:`bob.learn.boosting.Boosting` : Trains a strong machine of type :py:class:`bob.learn.boosting.BoostedMachine`.
* :py:class:`bob.learn.boosting.LUTTrainer` : Trains a weak machine of type :py:class:`bob.learn.boosting.LUTMachine`.
29
* :py:class:`bob.learn.boosting.StumpTrainer` : Trains a weak machine of type :py:class:`bob.learn.boosting.StumpMachine`.
30
31
32
33
34
35


Loss functions
..............

Loss functions are used to define new weights for the weak machines using the ``scipy.optimize.fmin_l_bfgs_b`` function.
36
A base class loss function :py:class:`bob.learn.boosting.LossFunction` is called by that function, and derived classes implement the actual loss for a single sample.
37
38
39
40
41
42

.. note::
  Loss functions are designed to be used in combination with a specific weak trainer in specific cases.
  Not all combinations of loss functions and weak trainers make sense.
  Here is a list of useful combinations:

43
44
45
  1. :py:class:`bob.learn.boosting.ExponentialLoss` with :py:class:`bob.learn.boosting.StumpTrainer` (uni-variate classification only).
  2. :py:class:`bob.learn.boosting.LogitLoss` with :py:class:`bob.learn.boosting.StumpTrainer` or :py:class:`bob.learn.boosting.LUTTrainer` (uni-variate or multi-variate classification).
  3. :py:class:`bob.learn.boosting.TangentialLoss` with :py:class:`bob.learn.boosting.StumpTrainer` or :py:class:`bob.learn.boosting.LUTTrainer` (uni-variate or multi-variate classification).
46
  4. :py:class:`bob.learn.boosting.JesorskyLoss` with :py:class:`bob.learn.boosting.LUTTrainer` (multi-variate regression only).
47

48
49
Details
.......
50

51
.. automodule:: bob.learn.boosting