Skip to content
Snippets Groups Projects
Commit f9ed9c56 authored by Tiago de Freitas Pereira's avatar Tiago de Freitas Pereira
Browse files

[precommit] fixes

parent a8f19ef1
No related branches found
No related tags found
No related merge requests found
Pipeline #59725 failed
This commit is part of merge request !53. Comments created here will be created in the context of that merge request.
import bob.extension import bob.extension
from .factor_analysis import ISVMachine, JFAMachine
from .gmm import GMMMachine, GMMStats from .gmm import GMMMachine, GMMStats
from .k_means import KMeansMachine from .k_means import KMeansMachine
from .linear_scoring import linear_scoring # noqa: F401 from .linear_scoring import linear_scoring # noqa: F401
from .wccn import WCCN from .wccn import WCCN
from .whitening import Whitening from .whitening import Whitening
from .factor_analysis import ISVMachine, JFAMachine
def get_config(): def get_config():
......
...@@ -6,7 +6,9 @@ import logging ...@@ -6,7 +6,9 @@ import logging
import numpy as np import numpy as np
from h5py import File as HDF5File
from sklearn.base import BaseEstimator from sklearn.base import BaseEstimator
from . import linear_scoring from . import linear_scoring
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
......
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
# Copyright (C) 2011-2014 Idiap Research Institute, Martigny, Switzerland # Copyright (C) 2011-2014 Idiap Research Institute, Martigny, Switzerland
import numpy as np import numpy as np
from bob.learn.em import GMMMachine, GMMStats, ISVMachine, JFAMachine from bob.learn.em import GMMMachine, GMMStats, ISVMachine, JFAMachine
import copy
def test_JFAMachine(): def test_JFAMachine():
...@@ -97,4 +97,3 @@ def test_ISVMachine(): ...@@ -97,4 +97,3 @@ def test_ISVMachine():
score_ref = -3.280498193082100 score_ref = -3.280498193082100
assert abs(score_ref - score) < eps assert abs(score_ref - score) < eps
pass
...@@ -6,9 +6,11 @@ ...@@ -6,9 +6,11 @@
# #
# Copyright (C) 2011-2014 Idiap Research Institute, Martigny, Switzerland # Copyright (C) 2011-2014 Idiap Research Institute, Martigny, Switzerland
import copy
import numpy as np import numpy as np
from bob.learn.em import GMMMachine, GMMStats, ISVMachine, JFAMachine from bob.learn.em import GMMMachine, GMMStats, ISVMachine, JFAMachine
import copy
# Define Training set and initial values for tests # Define Training set and initial values for tests
F1 = np.array( F1 = np.array(
...@@ -120,12 +122,11 @@ def test_JFATrainAndEnrol(): ...@@ -120,12 +122,11 @@ def test_JFATrainAndEnrol():
ubm.means = UBM_MEAN.reshape((2, 3)) ubm.means = UBM_MEAN.reshape((2, 3))
ubm.variances = UBM_VAR.reshape((2, 3)) ubm.variances = UBM_VAR.reshape((2, 3))
it = JFAMachine(ubm, 2, 2, em_iterations=10) it = JFAMachine(ubm, 2, 2, em_iterations=10)
# n_acc, f_acc = it.initialize(TRAINING_STATS_X, TRAINING_STATS_y)
it.U = copy.deepcopy(M_u) it.U = copy.deepcopy(M_u)
it.V = copy.deepcopy(M_v) it.V = copy.deepcopy(M_v)
it.D = copy.deepcopy(M_d) it.D = copy.deepcopy(M_d)
it.fit(TRAINING_STATS_X, TRAINING_STATS_y) it.fit(TRAINING_STATS_X, TRAINING_STATS_y)
# bob.learn.em.train_jfa(t, mb, TRAINING_STATS, initialize=False)
v_ref = np.array( v_ref = np.array(
[ [
...@@ -211,28 +212,6 @@ def test_JFATrainAndEnrol(): ...@@ -211,28 +212,6 @@ def test_JFATrainAndEnrol():
assert np.allclose(latent_y, y_ref, eps) assert np.allclose(latent_y, y_ref, eps)
assert np.allclose(latent_z, z_ref, eps) assert np.allclose(latent_z, z_ref, eps)
# Testing exceptions
"""
nose.tools.assert_raises(RuntimeError, t.initialize, mb, [1, 2, 2])
nose.tools.assert_raises(RuntimeError, t.initialize, mb, [[1, 2, 2]])
nose.tools.assert_raises(RuntimeError, t.e_step_u, mb, [1, 2, 2])
nose.tools.assert_raises(RuntimeError, t.e_step_u, mb, [[1, 2, 2]])
nose.tools.assert_raises(RuntimeError, t.m_step_u, mb, [1, 2, 2])
nose.tools.assert_raises(RuntimeError, t.m_step_u, mb, [[1, 2, 2]])
nose.tools.assert_raises(RuntimeError, t.e_step_v, mb, [1, 2, 2])
nose.tools.assert_raises(RuntimeError, t.e_step_v, mb, [[1, 2, 2]])
nose.tools.assert_raises(RuntimeError, t.m_step_v, mb, [1, 2, 2])
nose.tools.assert_raises(RuntimeError, t.m_step_v, mb, [[1, 2, 2]])
nose.tools.assert_raises(RuntimeError, t.e_step_d, mb, [1, 2, 2])
nose.tools.assert_raises(RuntimeError, t.e_step_d, mb, [[1, 2, 2]])
nose.tools.assert_raises(RuntimeError, t.m_step_d, mb, [1, 2, 2])
nose.tools.assert_raises(RuntimeError, t.m_step_d, mb, [[1, 2, 2]])
nose.tools.assert_raises(RuntimeError, t.enroll, m, [[1, 2, 2]], 5)
"""
def test_ISVTrainAndEnrol(): def test_ISVTrainAndEnrol():
# Train and enroll an 'ISVMachine' # Train and enroll an 'ISVMachine'
...@@ -325,13 +304,6 @@ def test_ISVTrainAndEnrol(): ...@@ -325,13 +304,6 @@ def test_ISVTrainAndEnrol():
latent_z = it.enroll(gse, 5) latent_z = it.enroll(gse, 5)
assert np.allclose(latent_z, z_ref, eps) assert np.allclose(latent_z, z_ref, eps)
# Testing exceptions
# nose.tools.assert_raises(RuntimeError, t.initialize, mb, [1, 2, 2])
# nose.tools.assert_raises(RuntimeError, t.initialize, mb, [[1, 2, 2]])
# nose.tools.assert_raises(RuntimeError, t.e_step, mb, [1, 2, 2])
# nose.tools.assert_raises(RuntimeError, t.e_step, mb, [[1, 2, 2]])
# nose.tools.assert_raises(RuntimeError, t.enroll, m, [[1, 2, 2]], 5)
def test_JFATrainInitialize(): def test_JFATrainInitialize():
# Check that the initialization is consistent and using the rng (cf. issue #118) # Check that the initialization is consistent and using the rng (cf. issue #118)
......
import matplotlib.pyplot as plt
import numpy as np
from sklearn.datasets import load_iris from sklearn.datasets import load_iris
import bob.learn.em import bob.learn.em
import matplotlib.pyplot as plt
import numpy as np
np.random.seed(2) # FIXING A SEED np.random.seed(2) # FIXING A SEED
......
import matplotlib.pyplot as plt
import numpy as np
from sklearn.datasets import load_iris from sklearn.datasets import load_iris
import bob.learn.em import bob.learn.em
import matplotlib.pyplot as plt
import numpy as np
np.random.seed(2) # FIXING A SEED np.random.seed(2) # FIXING A SEED
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment