Commit a4ac9c9b authored by Manuel Günther's avatar Manuel Günther

Fixed documentation of BIC

parent b2d0d7d1
......@@ -8,9 +8,14 @@ def bic_intra_extra_pairs(training_data):
The ``training_data`` should be aligned in a list of sub-lists, where each sub-list contains the data of one class.
This function will return two lists of tuples of data, where the first list contains tuples of the same class, while the second list contains tuples of different classes.
These tuples can be used to compute difference vectors, which then can be fed into the :py:meth:`bob.learn.linear.BICTrainer.train` method.
These tuples can be used to compute difference vectors, which then can be fed into the :py:meth:`BICTrainer.train` method.
Note that in general many more ``extra_pairs`` than ``intra_pairs`` are returned.
.. note::
In general, many more ``extra_pairs`` than ``intra_pairs`` are returned.
.. warning::
This function actually returns a two lists of pairs of references to the given data.
Even for relatively low numbers of classes and elements per class, the returned lists may contain billions of pairs, which require huge amounts of memory.
**Keyword parameters**
......@@ -45,16 +50,21 @@ def bic_intra_extra_pairs(training_data):
return (intra_pairs, extra_pairs)
def bic_intra_extra_pairs_between_factors(first_factor, second_factor):
"""bic_intra_extra_pairs(training_data) -> intra_pairs, extra_pairs
"""bic_intra_extra_pairs_between_factors(first_factor, second_factor) -> intra_pairs, extra_pairs
Computes intra-class and extra-class pairs from given training data, where only pairs between the first and second factors are considered.
Both ``first_factor`` and ``second_factor`` should be aligned in a list of sub-lists, where corresponding sub-list contains the data of one class.
Both lists need to contain the same classes in the same order; empty classes (empty lists) are allowed.
This function will return two lists of tuples of data, where the first list contains tuples of the same class, while the second list contains tuples of different classes.
These tuples can be used to compute difference vectors, which then can be fed into the :py:meth:`bob.learn.linear.BICTrainer.train` method.
These tuples can be used to compute difference vectors, which then can be fed into the :py:meth:`BICTrainer.train` method.
.. note::
In general, many more ``extra_pairs`` than ``intra_pairs`` are returned.
Note that in general many more ``extra_pairs`` than ``intra_pairs`` are returned.
.. warning::
This function actually returns a two lists of pairs of references to the given data.
Even for relatively low numbers of classes and elements per class, the returned lists may contain billions of pairs, which require huge amounts of memory.
**Keyword parameters**
......
......@@ -270,10 +270,11 @@ static auto similar_doc = bob::extension::FunctionDoc(
"The optional values ``r_epsilon`` and ``a_epsilon`` refer to the relative and absolute precision, similarly to :py:func:`numpy.allclose`.",
true
)
.add_prototype("other, [r_epsilon], [a_epsilon]")
.add_prototype("other, [r_epsilon], [a_epsilon]", "similar")
.add_parameter("other", ":py:class:`bob.learn.linear.BICMachine`", "The other BICMachine to compare with")
.add_parameter("r_epsilon", "float", "[Default: ``1e-5``] The relative precision")
.add_parameter("a_epsilon", "float", "[Default: ``1e-8``] The absolute precision")
.add_return("similar", "bool", "``True`` if the ``other`` machine is similar to this one, otherwise ``False``")
;
static PyObject* PyBobLearnLinearBICMachine_similar(PyBobLearnLinearBICMachineObject* self, PyObject* args, PyObject* kwargs) {
BOB_TRY
......
......@@ -29,6 +29,7 @@ Functions
.. autosummary::
bob.learn.linear.get_config
bob.learn.linear.bic_intra_extra_pairs
bob.learn.linear.bic_intra_extra_pairs_between_factors
.. automodule:: bob.learn.linear
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment