fatf.utils.distances.binary_distance

fatf.utils.distances.binary_distance(x, y, normalise=False)[source]

Computes the binary distance between two 1-dimensional arrays.

The distance is incremented by one for every position in the two input arrays where the value does not match. Each of the input arrays can be either a 1D numpy array or a row of a structured numpy array, i.e. numpy’s void.

Either of the input arrays is not of a base dtype. (See fatf.utils.array.validation.is_base_array function description for the explanation of a base dtype.)

Parameters
xUnion[numpy.ndarray, numpy.void]

The first numpy array (has to be 1-dimensional).

yUnion[numpy.ndarray, numpy.void]

The second numpy array (has to be 1-dimensional).

normaliseboolean, optional (default=False)

Whether to normalise the binary distance using the input array length.

Returns
distanceUnion[integer, float]

Binary distance between the two numpy arrays.

Raises
IncorrectShapeError

Either of the input arrays is not 1-dimensional or they are of a different length.