linkability()¶
- audmetric.linkability(truth, prediction, omega=1.0, nbins=None)[source]¶
Linkability for verification tasks.
Let be the provided prediction score for the similarity of the tested sample. The clipped local linkability metric is then defined as:
The higher the value, the more likely that an attacker can link two mated samples. The global linkability metric is the mean value over all local scores,1 and in the range and .
Implementation is based on code from M. Maouche, which is licensed under LGPL.
- 1
M. Gomez-Barrero, J. Galbally, C. Rathgeb, and C. Busch. General framework to evaluate unlinkability in biometric template protection systems. IEEE Transactions on Information Forensics and Security, 13:1406–1420, 2017. doi:10.1109/TIFS.2017.2788000.
- Parameters
truth (
Union
[bool
,int
,Sequence
[Union
[bool
,int
]]]) – ground truth classesprediction (
Union
[bool
,int
,float
,Sequence
[Union
[bool
,int
,float
]]]) – predicted classes or similarity scoresomega (
float
) – prior rationbins (
Optional
[int
]) – number of bins of the histograms that estimate the distributions of mated and non-mated scores. IfNone
it is set to
- Return type
float
- Returns
global linkability
- Raises
ValueError – if
truth
contains values different from1
,0
,True
,False
Examples
>>> np.random.seed(1) >>> samples = 10000 >>> truth = [1, 0] * int(samples / 2) >>> prediction = [] >>> for _ in range(int(samples / 2)): ... prediction.extend([np.random.uniform(0, 0.2), np.random.uniform(0.8, 1.0)]) >>> linkability(truth, prediction) 0.9747999999999999 >>> truth = [1, 0, 0, 0] * int(samples / 4) >>> prediction = [np.random.uniform(0, 1) for _ in range(samples)] >>> linkability(truth, prediction, omega=1 / 3) 0.0