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
416be191
There was a problem fetching the pipeline summary.
Commit
416be191
authored
7 years ago
by
Theophile GENTILHOMME
Browse files
Options
Downloads
Patches
Plain Diff
Add sort option (sorts return pos/neg scores) in the split function
parent
816862e7
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!146
Add 4-5-col files related functionalities and add click commands
,
!141
Add sort option (sorts return pos/neg scores) in the split function
Pipeline
#
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bob/bio/base/score/load.py
+36
-27
36 additions, 27 deletions
bob/bio/base/score/load.py
with
36 additions
and
27 deletions
bob/bio/base/score/load.py
+
36
−
27
View file @
416be191
...
...
@@ -289,38 +289,47 @@ def scores(filename, ncolumns=None):
return
_iterate_score_file
(
filename
)
def
split
(
filename
,
ncolumns
=
None
):
"""
split(filename, ncolumns=None) -> negatives, positives
Loads the scores from the given score file and splits them into positives and negatives.
Depending on the score file format, it calls see :py:func:`split_four_column`
and :py:func:`split_five_column` for details.
Parameters:
filename: :py:class:`str`, ``file-like``:
The file object that will be opened with :py:func:`open_file` containing the scores.
ncolumns: int or ``None``
If specified to be ``4`` or ``5``, the score file will be assumed to be in the given format.
If not specified, the score file format will be estimated automatically
Returns:
negatives: 1D :py:class:`numpy.ndarray` of type float
This array contains the list of scores, for which the ``claimed_id`` and the ``real_id`` are different (see :py:func:`four_column`)
positives: 1D :py:class:`numpy.ndarray` of type float
This array contains the list of scores, for which the ``claimed_id`` and the ``real_id`` are identical (see :py:func:`four_column`)
def
split
(
filename
,
ncolumns
=
None
,
sort
=
False
):
"""
Loads the scores from the given score file and splits them into positives
and negatives.
Depending on the score file format, it calls see
:py:func:`bob.measure.load.split_four_column` and
:py:func:`bob.measure.load.split_five_column` for details.
Parameters
----------
filename : str
The path to the score file.
ncolumns : int or ``None``
If specified to be ``4`` or ``5``, the score file will be assumed to be
in the given format. If not specified, the score file format will be
estimated automatically
sort : :obj:`bool`, optional
If ``True``, will return sorted negatives and positives
Returns
-------
negatives : 1D :py:class:`numpy.ndarray` of type float
This array contains the list of scores, for which the ``claimed_id`` and
the ``real_id`` are different (see :py:func:`four_column`)
positives : 1D :py:class:`numpy.ndarray` of type float
This array contains the list of scores, for which the ``claimed_id`` and
the ``real_id`` are identical (see :py:func:`four_column`)
"""
ncolumns
=
_estimate_score_file_format
(
filename
,
ncolumns
)
if
ncolumns
==
4
:
return
split_four_column
(
filename
)
neg
,
pos
=
split_four_column
(
filename
)
else
:
assert
ncolumns
==
5
return
split_five_column
(
filename
)
neg
,
pos
=
split_five_column
(
filename
)
if
sort
:
neg
.
sort
()
pos
.
sort
()
return
neg
,
pos
def
cmc
(
filename
,
ncolumns
=
None
):
...
...
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