fatf.accountability.data.measures.sampling_bias_grid_check

fatf.accountability.data.measures.sampling_bias_grid_check(counts: List[int], threshold: float = 0.8) → numpy.ndarray[source]

Checks for a pairwise sampling bias based on the provided threshold.

This functions checks the two-way (x/y and y/x proportion of counts) and if any of them (the absolute value of the proportion-1, to be precise) is below the threshold the given pair is considered to be suffering form a sampling bias.

Parameters
countsList[integer]

A list of integers representing the number of instances in every sub-group.

thresholdfloat, optional (default=0.8)

A threshold (number between 0 and 1 inclusive) that defines when a sampling bias occurs.

Returns
grid_checknumpy.ndarray

A square (with the width and height being the number of sub-groups defined by the counts parameter) symmetric boolean numpy arrays with True for every sub-group pair that violates the systematic bias threshold. The order of rows and columns correspond to the order of sub-groups in the counts parameter.

Raises
TypeError

The counts parameter is not a list or one of the elements of this list is not an integer. The threshold parameter is not a number.

ValueError

One of the counts is a negative integer. The threshold parameter out of range; the allowed range is 0 to 1 inclusive.

Examples using fatf.accountability.data.measures.sampling_bias_grid_check