Scores

class bosaris.Scores(scoresFileName='', scoresFileFormat='pickle')

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)

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)

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_tar_non(key)

Divides scores into target and non-target scores using information in a key.

Parameters:key – a Key object.
Returns:a vector of target scores.
Returns:a vector of non-target scores.
merge(scoreList)

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:scoreList – the list of Scores object to merge
read(inputFileName)

Read information from a file and constructs a Scores object. The type of file is deduced from the extension. The extension must be ‘.txt’ for a text file and ‘.hdf5’ or ‘.h5’ for a HDF5 file.

Parameters:inputFileName – name of the file o read from
read_pickle(inputFileName)

Read Scores in PICKLE format.

Parameters:inputFileName – name of the file to read from
read_txt(inputFileName)

Creates a Scores object from information stored in a text file.

Parameters:inputFileName – name of the file to read from
save(outputFileName)

Save the Scores object to file. The format of the file is deduced from the extension of the filename. The format can be PICKLE, HDF5 or text. Extension for text file should be ‘.p’ for pickle ‘.txt’ and for HDF5 it should be ‘.hdf5’ or ‘.h5’

Parameters:outputFileName – name of the file to write to
save_pickle(outputFileName)

Save Scores in PICKLE format. If Python > 3.3, scores are converted to float32 before saving to save space.

Parameters:outputFilename – name of the file to write to
save_txt(outputFileName)

Save a Scores object in a text file

Parameters:outputFileName – name of the file to write to
set_missing_to_value(ndx, value)

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).

sort()

Sort models and segments

validate()

Checks that an object of type Scores obeys certain rules that must always be true.

Returns:a boolean value indicating whether the object is valid.

Previous topic

PlotWindow

Next topic

The frontend package

This Page