Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.learn.em
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
bob
bob.learn.em
Commits
770e701c
Commit
770e701c
authored
3 years ago
by
Amir MOHAMMADI
Browse files
Options
Downloads
Patches
Plain Diff
[factor_analysis] make main score using data not stats
parent
d41ca91a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!53
Factor Analysis on pure python
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bob/learn/em/factor_analysis.py
+4
-4
4 additions, 4 deletions
bob/learn/em/factor_analysis.py
bob/learn/em/test/test_factor_analysis.py
+4
-4
4 additions, 4 deletions
bob/learn/em/test/test_factor_analysis.py
with
8 additions
and
8 deletions
bob/learn/em/factor_analysis.py
+
4
−
4
View file @
770e701c
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
bob/learn/em/test/test_factor_analysis.py
+
4
−
4
View file @
770e701c
...
...
@@ -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
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment