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

Started porting documentation to the bob::extension classes

parent a4ac9c9b
......@@ -62,13 +62,6 @@ namespace bob { namespace learn { namespace linear {
return !(this->operator==(other));
}
bool FisherLDATrainer::is_similar_to
(const FisherLDATrainer& other, const double r_epsilon,
const double a_epsilon) const
{
return this->operator==(other);
}
/**
* Returns the indexes for sorting a given blitz::Array<double,1>
*/
......
......@@ -54,11 +54,6 @@ namespace bob { namespace learn { namespace linear {
}
bool PCATrainer::is_similar_to (const PCATrainer& other, const double r_epsilon,
const double a_epsilon) const {
return this->operator==(other);
}
/**
* Sets up the machine calculating the PC's via the Covariance Matrix
*/
......
......@@ -73,12 +73,6 @@ namespace bob { namespace learn { namespace linear {
*/
bool operator!=(const FisherLDATrainer& other) const;
/**
* @brief Similar to
*/
bool is_similar_to(const FisherLDATrainer& other,
const double r_epsilon=1e-5, const double a_epsilon=1e-8) const;
/**
* @brief Gets the pseudo-inverse flag
*/
......
......@@ -97,12 +97,6 @@ namespace bob { namespace learn { namespace linear {
*/
void setSafeSVD (bool value) { m_safe_svd = value; }
/**
* @brief Similar to
*/
bool is_similar_to(const PCATrainer& other,
const double r_epsilon=1e-5, const double a_epsilon=1e-8) const;
/**
* @brief Trains the LinearMachine to perform the KLT. The resulting
* machine will have the eigen-vectors of the covariance matrix arranged
......
This diff is collapsed.
This diff is collapsed.
......@@ -36,19 +36,13 @@ static PyModuleDef module_definition = {
};
#endif
extern bool init_BobLearnLinearMachine(PyObject* module);
extern bool init_BobLearnLinearPCA(PyObject* module);
extern bool init_BobLearnLinearLDA(PyObject* module);
extern bool init_BobLearnLinearBIC(PyObject* module);
static PyObject* create_module (void) {
PyBobLearnLinearMachine_Type.tp_new = PyType_GenericNew;
if (PyType_Ready(&PyBobLearnLinearMachine_Type) < 0) return 0;
PyBobLearnLinearPCATrainer_Type.tp_new = PyType_GenericNew;
if (PyType_Ready(&PyBobLearnLinearPCATrainer_Type) < 0) return 0;
PyBobLearnLinearFisherLDATrainer_Type.tp_new = PyType_GenericNew;
if (PyType_Ready(&PyBobLearnLinearFisherLDATrainer_Type) < 0) return 0;
PyBobLearnLinearCGLogRegTrainer_Type.tp_new = PyType_GenericNew;
if (PyType_Ready(&PyBobLearnLinearCGLogRegTrainer_Type) < 0) return 0;
......@@ -67,15 +61,6 @@ static PyObject* create_module (void) {
auto m_ = make_safe(m);
/* register the types to python */
Py_INCREF(&PyBobLearnLinearMachine_Type);
if (PyModule_AddObject(m, "Machine", (PyObject *)&PyBobLearnLinearMachine_Type) < 0) return 0;
Py_INCREF(&PyBobLearnLinearPCATrainer_Type);
if (PyModule_AddObject(m, "PCATrainer", (PyObject *)&PyBobLearnLinearPCATrainer_Type) < 0) return 0;
Py_INCREF(&PyBobLearnLinearFisherLDATrainer_Type);
if (PyModule_AddObject(m, "FisherLDATrainer", (PyObject *)&PyBobLearnLinearFisherLDATrainer_Type) < 0) return 0;
Py_INCREF(&PyBobLearnLinearCGLogRegTrainer_Type);
if (PyModule_AddObject(m, "CGLogRegTrainer", (PyObject *)&PyBobLearnLinearCGLogRegTrainer_Type) < 0) return 0;
......@@ -85,6 +70,9 @@ static PyObject* create_module (void) {
Py_INCREF(&PyBobLearnLinearWCCNTrainer_Type);
if (PyModule_AddObject(m, "WCCNTrainer", (PyObject *)&PyBobLearnLinearWCCNTrainer_Type) < 0) return 0;
if (!init_BobLearnLinearMachine(m)) return 0;
if (!init_BobLearnLinearPCA(m)) return 0;
if (!init_BobLearnLinearLDA(m)) return 0;
if (!init_BobLearnLinearBIC(m)) return 0;
static void* PyBobLearnLinear_API[PyBobLearnLinear_API_pointers];
......
This diff is collapsed.
......@@ -362,16 +362,12 @@ def test_pca_trainer_comparisons():
t3 = PCATrainer(t2)
t4 = t3
assert t1 == t2
assert t1.is_similar_to(t2)
assert t1 == t3
assert t1.is_similar_to(t3)
assert t1 == t4
assert t1.is_similar_to(t4)
t5 = PCATrainer(False)
t6 = PCATrainer(False)
assert t5 == t6
assert t5.is_similar_to(t6)
assert t5 != t1
t7 = PCATrainer(t1)
......@@ -459,21 +455,25 @@ def test_pca_svd_vs_cov_random_2_safe():
def test_fisher_lda_settings():
t = FisherLDATrainer()
assert t.use_pinv == False
assert t.strip_to_rank == True
assert not t.use_pinv
assert t.strip_to_rank
t.use_pinv = True
assert t.use_pinv
t.strip_to_rank = False
assert t.strip_to_rank == False
assert not t.strip_to_rank
t = FisherLDATrainer(use_pinv=True)
assert t.use_pinv
assert t.strip_to_rank
t = FisherLDATrainer(strip_to_rank=False)
assert t.use_pinv == False
assert t.strip_to_rank == False
assert not t.use_pinv
assert not t.strip_to_rank
t = FisherLDATrainer(use_pinv=True, strip_to_rank=False)
assert t.use_pinv
assert not t.strip_to_rank
def test_fisher_lda():
......@@ -583,18 +583,13 @@ def test_fisher_lda_comparisons():
t3 = FisherLDATrainer(t2)
t4 = t3
assert t1 == t2
assert t1.is_similar_to(t2)
assert t1 == t3
assert t1.is_similar_to(t3)
assert t1 == t4
assert t1.is_similar_to(t4)
t3 = FisherLDATrainer(use_pinv=True)
t4 = FisherLDATrainer(use_pinv=True)
assert t3 == t4
assert t3.is_similar_to(t4)
assert t3 != t1
assert not t3.is_similar_to(t2)
def test_whitening_initialization():
......
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