Scores¶
-
class
bosaris.
Scores
(scores_file_name='')[source]¶ A class for storing scores for trials. The modelset and segset fields are lists of model and test segment names respectively. The element i,j of scoremat and scoremask corresponds to the trial involving model i and test segment j.
- Attr modelset
list of unique models in a ndarray
- Attr segset
list of unique test segments in a ndarray
- Attr scoremask
2D ndarray of boolean which indicates the trials of interest i.e. the entry i,j in scoremat should be ignored if scoremask[i,j] is False
- Attr scoremat
2D ndarray of scores
-
align_with_ndx
(ndx)[source]¶ The ordering in the output Scores object corresponds to ndx, so aligning several Scores objects with the same ndx will result in them being comparable with each other.
- Parameters
ndx – a Key or Ndx object
- Returns
resized version of the current Scores object to size of ‘ndx’ and reordered according to the ordering of modelset and segset in ‘ndx’.
-
filter
(modlist, seglist, keep)[source]¶ Removes some of the information in a Scores object. Useful for creating a gender specific score set from a pooled gender score set. Depending on the value of ‘keep’, the two input lists indicate the models and test segments (and their associated scores) to retain or discard.
- Parameters
modlist – a list of strings which will be compared with the modelset of the current Scores object.
seglist – a list of strings which will be compared with the segset of ‘inscr’.
keep – a boolean indicating whether modlist and seglist are the models to keep or discard.
- Returns
a filtered version of ‘inscr’.
-
get_score
(modelID, segID)[source]¶ return a score given a model and segment identifiers raise an error if the trial does not exist :param modelID: id of the model :param segID: id of the test segment
-
get_tar_non
(key)[source]¶ Divides scores into target and non-target scores using information in a key.
- Parameters
key – a Key object.
- Returns
a vector of target scores. :return: a vector of non-target scores.
-
merge
(score_list)[source]¶ Merges a list of Scores objects into the current one. The resulting must have all models and segment in the input Scores (only once) and the union of all the scoremasks. It is an error if two of the input Scores objects have a score for the same trial.
- Parameters
score_list – the list of Scores object to merge
-
static
read
(input_file_name)[source]¶ Read a Scores object from information in a hdf5 file.
- Parameters
input_file_name – name of the file to read from
-
static
read_matlab
(input_file_name)[source]¶ Read a Scores object from information in a hdf5 file in Matlab BOSARIS format.
- Parameters
input_file_name – name of the file to read from
-
set_missing_to_value
(ndx, value)[source]¶ Sets all scores for which the trialmask is true but the scoremask is false to the same value, supplied by the user.
- Parameters
ndx – a Key or Ndx object.
value – a value for the missing scores.
- Returns
a Scores object (with the missing scores added and set to value).