T-norms

Triangular norms for soft and uncertain ground truth.

When the label matrix is soft — annotator proportions, crowd labels, or a probabilistic reference standard — the Boolean conjunction that defines the four cells must be replaced by a t-norm \(T\), with the standard complement \(N(x) = 1 - x\):

\[TP = T(y, \hat{y}),\quad FP = T(1-y, \hat{y}),\quad FN = T(y, 1-\hat{y}),\quad TN = T(1-y, 1-\hat{y}).\]

The product t-norm is the only choice for which the resulting cells preserve the row and column marginals,

\[TP + FN = y, \qquad TP + FP = \hat{y},\]

and hence the only one under which the fuzzy confusion matrix behaves like a contingency table. marginal_defect() measures departure from that property, and returns zero only for product.

Note that the pointwise ordering \(T_L \le T_P \le T_M\) applies to all four cell matrices in the same direction, since all four are produced by the same t-norm. It therefore implies nothing about the direction in which a derived ratio moves: numerator and denominator shrink together.

aggmetrics.tnorms.get_tnorm(name)

Resolve a t-norm by name ('product', 'godel', 'lukasiewicz' and aliases), or return a callable T(a, b) unchanged.

Parameters:

name (str | Callable)

Return type:

Callable

aggmetrics.tnorms.marginal_defect(tnorm, grid=21)

Maximum violation of marginal consistency over a grid of [0,1]^2.

Zero iff T(a,b) + T(a,1-b) == a and T(a,b) + T(1-a,b) == b throughout, which holds only for the product t-norm.

Parameters:
Return type:

float

aggmetrics.tnorms.godel(a, b)

Minimum (Gödel) t-norm: the largest t-norm.

aggmetrics.tnorms.product(a, b)

Product t-norm: the unique marginally consistent choice.

aggmetrics.tnorms.lukasiewicz(a, b)

Łukasiewicz t-norm: credits only overlap above the unit threshold.