Commit 0c86dfbf authored by Manuel Günther's avatar Manuel Günther

Added 'input_size' member to BICMachine

parent 74a65610
......@@ -200,6 +200,16 @@ int PyBobLearnLinearBICMachine_setDFFS(PyBobLearnLinearBICMachineObject* self, P
return 0;
}
static auto input_size_doc = bob::extension::VariableDoc(
"input_size",
"int",
"The expected input dimensionality, read-only"
);
PyObject* PyBobLearnLinearBICMachine_getInputSize(PyBobLearnLinearBICMachineObject* self, void*){
return Py_BuildValue("i", self->cxx->input_size());
}
static PyGetSetDef PyBobLearnLinearBICMachine_getseters[] = {
{
dffs_doc.name(),
......@@ -208,6 +218,13 @@ static PyGetSetDef PyBobLearnLinearBICMachine_getseters[] = {
dffs_doc.doc(),
0
},
{
input_size_doc.name(),
(getter)PyBobLearnLinearBICMachine_getInputSize,
0,
input_size_doc.doc(),
0
},
{0} /* Sentinel */
};
......
......@@ -79,6 +79,9 @@ namespace bob { namespace learn { namespace linear {
//! Use the Distance From Feature Space
bool use_DFFS() const {return m_use_DFFS;}
//! Expected input dimensionality
int input_size() const {return m_mu_I.extent(0);}
private:
//! initializes internal data storages for the given class
......
......@@ -87,6 +87,8 @@ def test_BIC():
# First, train the machine with intrapersonal data only
trainer.train(intra_data, intra_data, machine)
assert machine.input_size == 5
# => every result should be zero
assert abs(machine(eval_data(0))) < eps
assert abs(machine(eval_data(1))) < eps
......
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