Skip to content
Snippets Groups Projects
Commit 770e701c authored by Amir MOHAMMADI's avatar Amir MOHAMMADI
Browse files

[factor_analysis] make main score using data not stats

parent d41ca91a
No related branches found
No related tags found
1 merge request!53Factor Analysis on pure python
......@@ -1136,7 +1136,7 @@ class FactorAnalysisBase(BaseEstimator):
return fn_x.flatten()
def score_with_array(self, model, data):
def score(self, model, data):
"""
Computes the ISV score using a numpy array as input
......@@ -1155,7 +1155,7 @@ class FactorAnalysisBase(BaseEstimator):
"""
return self.score(model, self.ubm.transform(data))
return self.score_using_stats(model, self.ubm.transform(data))
class ISVMachine(FactorAnalysisBase):
......@@ -1349,7 +1349,7 @@ class ISVMachine(FactorAnalysisBase):
"""
return self.enroll([self.ubm.transform(X)], iterations)
def score(self, latent_z, data):
def score_using_stats(self, latent_z, data):
"""
Computes the ISV score
......@@ -1839,7 +1839,7 @@ class JFAMachine(FactorAnalysisBase):
return self
def score(self, model, data):
def score_using_stats(self, model, data):
"""
Computes the JFA score
......
......@@ -392,14 +392,14 @@ def test_JFAMachine():
model = [y, z]
score_ref = -2.111577181208289
score = m.score(model, gs)
score = m.score_using_stats(model, gs)
np.testing.assert_allclose(score, score_ref, atol=eps)
# Scoring with numpy array
np.random.seed(0)
X = np.random.normal(loc=0.0, scale=1.0, size=(50, 3))
score_ref = 2.028009315286946
score = m.score_with_array(model, X)
score = m.score(model, X)
np.testing.assert_allclose(score, score_ref, atol=eps)
......@@ -431,7 +431,7 @@ def test_ISVMachine():
# Enrolled model
latent_z = np.array([3, 4, 1, 2, 0, 1], "float64")
score = isv_machine.score(latent_z, gs)
score = isv_machine.score_using_stats(latent_z, gs)
score_ref = -3.280498193082100
np.testing.assert_allclose(score, score_ref, atol=eps)
......@@ -439,5 +439,5 @@ def test_ISVMachine():
np.random.seed(0)
X = np.random.normal(loc=0.0, scale=1.0, size=(50, 3))
score_ref = -1.2343813195374242
score = isv_machine.score_with_array(latent_z, X)
score = isv_machine.score(latent_z, X)
np.testing.assert_allclose(score, score_ref, atol=eps)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment