diarization_error_rate()¶
- audmetric.diarization_error_rate(truth, prediction, *, individual_file_mapping=False, num_workers=1, multiprocessing=False)[source]¶
Diarization error rate.
where is the total confusion duration, is the total duration of predictions without an overlapping ground truth, is the total duration of ground truth without an overlapping prediction, and is the total duration of ground truth segments.
The diarization error rate can used when the labels are not known by the prediction model, e.g. for the task of speaker diarization on unknown speakers.
This metric is computed the same way as
audmetric.identification_error_rate(), but first creates a one-to-one mapping between truth and prediction labels.This implementation uses the ‘greedy’ method to compute the one-to-one mapping between truth and predicted labels. This method is faster than other implementations that optimize the confusion term, but may slightly over-estimate the diarization error rate. [1]
- Parameters:
truth (
Series) – ground truth labels with a segmented index conform to audformatprediction (
Series) – predicted labels with a segmented index conform to audformatindividual_file_mapping (
bool) – whether to create the mapping between truth and prediction labels individually for each file. IfFalse, all segments are taken into account to compute the mappingnum_workers (
int) – number of threads or 1 for sequential processingmultiprocessing (
bool) – use multiprocessing instead of multithreading
- Return type:
float- Returns:
diarization error rate
- Raises:
ValueError – if
truthorpredictiondo not have a segmented index conform to audformat
Examples
>>> import pandas as pd >>> import audformat >>> truth = pd.Series( ... index=audformat.segmented_index( ... files=["f1.wav", "f1.wav"], ... starts=[0.0, 0.1], ... ends=[0.1, 0.2], ... ), ... data=["a", "b"], ... ) >>> prediction = pd.Series( ... index=audformat.segmented_index( ... files=["f1.wav", "f1.wav", "f1.wav"], ... starts=[0, 0.1, 0.1], ... ends=[0.1, 0.15, 0.2], ... ), ... data=["0", "1", "0"], ... ) >>> diarization_error_rate(truth, prediction) 0.5