mode()

audpsychometric.mode(ratings, *, axis=1)[source]

Mode of categorical ratings.

None and nan values are ignored per item. If the values are numerical and there are several winning categories, the average over those is returned, and rounded to the next higher integer. If the values are not numerical, the first occurring value is returned.

Parameters
  • ratings (Sequence) – ratings. When given as a 1-dimensional array, it is treated as a row vector

  • axis (int) – axis along which the mode is computed. A value of 1 assumes stimuli as rows and raters as columns

Return type

Any

Returns

mode over raters

Examples

>>> mode([0, 0, 1])
0
>>> mode(["a", "a", "b"])
'a'
>>> mode([0, 1])
1
>>> mode(["a", "b"])
'a'
>>> mode([0, 2])
1
>>> mode(["a", "c"])
'a'
>>> mode([None, None, "a"])
'a'