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
8619c0c1
Commit
8619c0c1
authored
10 years ago
by
Manuel Günther
Browse files
Options
Downloads
Patches
Plain Diff
Added rng to train_jfa method.
parent
1eab675d
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bob/learn/em/train.py
+15
-10
15 additions, 10 deletions
bob/learn/em/train.py
with
15 additions
and
10 deletions
bob/learn/em/train.py
+
15
−
10
View file @
8619c0c1
...
...
@@ -57,25 +57,30 @@ def train(trainer, machine, data, max_iterations = 50, convergence_threshold=Non
trainer
.
finalize
(
machine
,
data
)
def
train_jfa
(
trainer
,
jfa_base
,
data
,
max_iterations
=
10
,
initialize
=
True
):
def
train_jfa
(
trainer
,
jfa_base
,
data
,
max_iterations
=
10
,
initialize
=
True
,
rng
=
None
):
"""
Trains a :py:class`bob.learn.em.JFABase` given a :py:class`bob.learn.em.JFATrainer` and the proper data
**Parameters**:
trainer
A trainer mechanism
(:py:class`bob.learn.em.JFATrainer`)
machine
A container machine
(:py:class`bob.learn.em.JFABase`)
data
The data to be trained
list(list(:py:class`bob.learn.em.GMMStats`))
max_iterations
trainer
: :py:class`bob.learn.em.JFATrainer`
A
JFA
trainer mechanism
jfa_base : :py:class`bob.learn.em.JFABase`
A container machine
data
: [[:py:class`bob.learn.em.GMMStats`]]
The data to be trained
max_iterations
: int
The maximum number of iterations to train a machine
initialize
initialize
: bool
If True, runs the initialization procedure
rng : :py:class:`bob.core.random.mt19937`
The Mersenne Twister mt19937 random generator used for the initialization of subspaces/arrays before the EM loops
"""
if
initialize
:
trainer
.
initialize
(
jfa_base
,
data
)
if
rng
is
not
None
:
trainer
.
initialize
(
jfa_base
,
data
,
rng
)
else
:
trainer
.
initialize
(
jfa_base
,
data
)
#V Subspace
for
i
in
range
(
max_iterations
):
...
...
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