From 11d18a5a0dc0bf98c3e2c745ccf58a0029bc7686 Mon Sep 17 00:00:00 2001 From: Andre Anjos <andre.anjos@idiap.ch> Date: Mon, 10 Apr 2017 15:57:34 +0200 Subject: [PATCH] Implement test unit showing the problem (see #9) --- bob/learn/libsvm/test_trainer.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/bob/learn/libsvm/test_trainer.py b/bob/learn/libsvm/test_trainer.py index 060326c..74f4b4d 100644 --- a/bob/learn/libsvm/test_trainer.py +++ b/bob/learn/libsvm/test_trainer.py @@ -214,4 +214,21 @@ def test_training_one_class(): curr_scores = numpy.array(curr_scores) prev_scores = numpy.array(prev_scores) assert numpy.all(abs(curr_scores - prev_scores) < 1e-8) - + + +def test_successive_training(): + + # Tests successive training works: i.e., training a couple of machines one + # after the other. + + numpy.random.seed(10) + + for i in range(2): + pos = numpy.random.normal(0., 1, size=(100, 2)) + neg = numpy.random.normal(1., 1, size=(100, 2)) + data = [pos, neg] + + trainer = Trainer() + trainer.kernel_type = 'LINEAR' + trainer.cost = 1 + trainer.train(data) -- GitLab