Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.measure
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.measure
Commits
18ecfb37
There was a problem fetching the pipeline summary.
Commit
18ecfb37
authored
8 years ago
by
Manuel Günther
Browse files
Options
Downloads
Patches
Plain Diff
Moved loading of scores into separate function
parent
504a69fc
No related branches found
No related tags found
1 merge request
!20
Resolve "load_scores extremely memory hungry"
Pipeline
#
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bob/measure/load.py
+18
-18
18 additions, 18 deletions
bob/measure/load.py
with
18 additions
and
18 deletions
bob/measure/load.py
+
18
−
18
View file @
18ecfb37
...
...
@@ -93,16 +93,8 @@ def four_column(filename):
float: The result of the comparison of the model and the probe
"""
return
_iterate_score_file
(
filename
)
opened
=
open_file
(
filename
,
'
rb
'
)
if
sys
.
version_info
.
major
>
2
:
import
io
opened
=
io
.
TextIOWrapper
(
opened
,
newline
=
""
)
reader
=
csv
.
reader
(
opened
,
delimiter
=
'
'
)
for
splits
in
reader
:
splits
[
-
1
]
=
float
(
splits
[
-
1
])
yield
splits
def
split_four_column
(
filename
):
...
...
@@ -220,15 +212,7 @@ def five_column(filename):
"""
opened
=
open_file
(
filename
,
'
rb
'
)
if
sys
.
version_info
.
major
>
2
:
import
io
opened
=
io
.
TextIOWrapper
(
opened
,
newline
=
""
)
reader
=
csv
.
reader
(
opened
,
delimiter
=
'
'
)
for
splits
in
reader
:
splits
[
-
1
]
=
float
(
splits
[
-
1
])
yield
splits
return
_iterate_score_file
(
filename
)
def
split_five_column
(
filename
):
...
...
@@ -421,6 +405,22 @@ def dump_score(filename, score_lines):
numpy
.
savetxt
(
filename
,
score_lines
,
fmt
=
fmt
)
def
_iterate_score_file
(
filename
):
"""
Opens the score file for reading and yields the score file line by line in a tuple/list.
The last element of the line (which is the score) will be transformed to float, the other elements will be str
"""
opened
=
open_file
(
filename
,
'
rb
'
)
if
sys
.
version_info
.
major
>
2
:
import
io
opened
=
io
.
TextIOWrapper
(
opened
,
newline
=
""
)
reader
=
csv
.
reader
(
opened
,
delimiter
=
'
'
)
for
splits
in
reader
:
splits
[
-
1
]
=
float
(
splits
[
-
1
])
yield
splits
def
_split_scores
(
score_lines
,
real_id_index
,
claimed_id_index
=
0
,
score_index
=
-
1
):
"""
Take the output of :py:func:`four_column` or :py:func:`five_column` and return negatives and positives.
"""
...
...
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