skcriteria.utils.dict_cmp module

Utilities to compare two dictionaries with numpy arrays.

skcriteria.utils.dict_cmp.dict_allclose(left, right, rtol=1e-05, atol=1e-08, equal_nan=False)[source]

Compares two dictionaries. If values of type “numpy.array” are encountered, the function utilizes “numpy.allclose” for comparison.

  • left (dict) – The left dictionary.

  • right (dict) – The right dictionary.

  • rtol (float, optional) – The relative tolerance parameter for np.allclose.

  • atol (float, optional) – The absolute tolerance parameter for np.allclose.

  • equal_nan (bool, optional) – Whether to consider NaN values as equal.


True if the dictionaries are equal, False otherwise.

Return type:



This function iteratively compares the values of corresponding keys in the input dictionaries left and right. It handles various data types, including NumPy arrays, and uses the np.allclose function for numeric array comparisons with customizable tolerance levels. The comparison is performed iteratively, and the function returns True if all values are equal based on the specified criteria. If the dictionaries have different lengths or keys, or if the types of corresponding values differ, the function returns False.