fatf.utils.distances.check_distance_functionality

fatf.utils.distances.check_distance_functionality(distance_function: Callable[[...], numpy.ndarray], suppress_warning: bool = False) → bool[source]

Checks whether a distance function takes exactly 2 required parameters.

New in version 0.0.2.

The distance function to be checked should calculate a distance matrix (2-dimensional numpy array) between all of the rows of the two 2-dimensional numpy arrays passed as input to the distance_function.

Parameters
distance_functionCallable[[numpy.ndarray, numpy.ndarray, …], numpy.ndarray]

A function that calculates a distance matrix between all pairs of rows of the two input arrays.

suppress_warningboolean, optional (default=False)

A boolean parameter that indicates whether the function should suppress its warning message. Defaults to False.

Returns
is_functionalboolean

A boolean variable that indicates whether the distance function is valid.

Raises
TypeError

The distance_function parameter is not a Python callable or the suppress_warning parameter is not a boolean.

Warns
UserWarning

Warns about the details of the required functionality that the distance function lacks.