Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.bio.base
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.bio.base
Commits
8d7187da
There was a problem fetching the pipeline summary.
Commit
8d7187da
authored
6 years ago
by
Theophile GENTILHOMME
Browse files
Options
Downloads
Patches
Plain Diff
Use fully-quoted functions for random
parent
812c796b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!146
Add 4-5-col files related functionalities and add click commands
Pipeline
#
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bob/bio/base/script/gen.py
+9
-9
9 additions, 9 deletions
bob/bio/base/script/gen.py
with
9 additions
and
9 deletions
bob/bio/base/script/gen.py
+
9
−
9
View file @
8d7187da
...
@@ -4,11 +4,11 @@ import pkg_resources # to make sure bob gets imported properly
...
@@ -4,11 +4,11 @@ import pkg_resources # to make sure bob gets imported properly
import
os
import
os
import
logging
import
logging
import
numpy
import
numpy
import
random
as
rd
import
random
import
click
import
click
from
click.types
import
FLOAT
from
click.types
import
FLOAT
from
bob.extension.scripts.click_helper
import
verbosity_option
from
bob.extension.scripts.click_helper
import
verbosity_option
from
bob.core
import
random
import
bob.core
from
bob.io.base
import
create_directories_safe
from
bob.io.base
import
create_directories_safe
logger
=
logging
.
getLogger
(
__name__
)
logger
=
logging
.
getLogger
(
__name__
)
...
@@ -37,10 +37,10 @@ def gen_score_distr(mean_neg, mean_pos, sigma_neg=10, sigma_pos=10):
...
@@ -37,10 +37,10 @@ def gen_score_distr(mean_neg, mean_pos, sigma_neg=10, sigma_pos=10):
pos_scores : :any:`list`
pos_scores : :any:`list`
Positive scores
Positive scores
"""
"""
mt
=
random
.
mt19937
()
# initialise the random number generator
mt
=
bob
.
core
.
random
.
mt19937
()
# initialise the random number generator
neg_generator
=
random
.
normal
(
numpy
.
float32
,
mean_neg
,
sigma_neg
)
neg_generator
=
bob
.
core
.
random
.
normal
(
numpy
.
float32
,
mean_neg
,
sigma_neg
)
pos_generator
=
random
.
normal
(
numpy
.
float32
,
mean_pos
,
sigma_pos
)
pos_generator
=
bob
.
core
.
random
.
normal
(
numpy
.
float32
,
mean_pos
,
sigma_pos
)
neg_scores
=
[
neg_generator
(
mt
)
for
_
in
range
(
NUM_NEG
)]
neg_scores
=
[
neg_generator
(
mt
)
for
_
in
range
(
NUM_NEG
)]
pos_scores
=
[
pos_generator
(
mt
)
for
_
in
range
(
NUM_NEG
)]
pos_scores
=
[
pos_generator
(
mt
)
for
_
in
range
(
NUM_NEG
)]
...
@@ -67,12 +67,12 @@ def write_scores_to_file(pos, neg, filename, n_sys=1, five_col=False):
...
@@ -67,12 +67,12 @@ def write_scores_to_file(pos, neg, filename, n_sys=1, five_col=False):
s_names
=
[
'
s%d
'
%
i
for
i
in
range
(
n_sys
)]
s_names
=
[
'
s%d
'
%
i
for
i
in
range
(
n_sys
)]
with
open
(
filename
,
'
wt
'
)
as
f
:
with
open
(
filename
,
'
wt
'
)
as
f
:
for
i
in
pos
:
for
i
in
pos
:
s_name
=
r
d
.
choice
(
s_names
)
s_name
=
r
andom
.
choice
(
s_names
)
s_five
=
'
'
if
not
five_col
else
'
d
'
+
r
d
.
choice
(
s_names
)
+
'
'
s_five
=
'
'
if
not
five_col
else
'
d
'
+
r
andom
.
choice
(
s_names
)
+
'
'
f
.
write
(
'
x%sx %s %f
\n
'
%
(
s_five
,
s_name
,
i
))
f
.
write
(
'
x%sx %s %f
\n
'
%
(
s_five
,
s_name
,
i
))
for
i
in
neg
:
for
i
in
neg
:
s_name
=
r
d
.
choice
(
s_names
)
s_name
=
r
andom
.
choice
(
s_names
)
s_five
=
'
'
if
not
five_col
else
'
d
'
+
r
d
.
choice
(
s_names
)
+
'
'
s_five
=
'
'
if
not
five_col
else
'
d
'
+
r
andom
.
choice
(
s_names
)
+
'
'
f
.
write
(
'
x%sy %s %f
\n
'
%
(
s_five
,
s_name
,
i
))
f
.
write
(
'
x%sy %s %f
\n
'
%
(
s_five
,
s_name
,
i
))
@click.command
()
@click.command
()
...
...
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