DiCE icon indicating copy to clipboard operation
DiCE copied to clipboard

visualize_as_dataframe show_only_changes doesn't appear to work with floating point numbers

Open bdavj opened this issue 2 years ago • 0 comments

When setting show_only_changes=true, visualize_as_dataframe still appears to show all data, as the precision seems to be changing.

Would suggest there should be a fuzz factor in the comparison for display to avoid the FP comparison pitfalls.

AIUI, CounterfactualExamples uses the following:

if newli[ix][jx] == org[jx]:

Which introduces float comparison issues (i.e. in some cases, nothing with equate due to minor fluctuations, even if seemingly unchanged).

This should be using math.isclose with a factor of org[ix]/1000000 or similar.

bdavj avatar Mar 15 '23 12:03 bdavj