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.
- Parameters:
- Returns:
True if the dictionaries are equal, False otherwise.
- Return type:
Notes
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.