File tree Expand file tree Collapse file tree
omnixai/explainers/tabular/counterfactual/mace Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44# SPDX-License-Identifier: BSD-3-Clause
55# For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
66#
7- import numpy as np
87import pandas as pd
98from typing import Dict , Callable , Union
109
@@ -45,7 +44,7 @@ def _refine(
4544
4645 for col , (a , b ) in cont_features .items ():
4746 gap , r = b - a , None
48- while (b - a ) / ( gap + 1e-3 ) > 0.1 :
47+ while (b - a ) / gap > 0.1 :
4948 z = (a + b ) * 0.5
5049 y .iloc [0 , column2loc [col ]] = z
5150 scores = predict_function (Tabular (data = y , categorical_columns = instance .categorical_columns ))[0 ]
@@ -83,8 +82,8 @@ def refine(
8382 cont_features = {}
8483 for col in self .cont_columns :
8584 a , b = float (x [col ].values [0 ]), float (y [col ].values [0 ])
86- if a != b :
87- cont_features [col ] = (a , b ) if a <= b else ( b , a )
85+ if abs ( a - b ) > 1e-6 :
86+ cont_features [col ] = (a , b )
8887 if len (cont_features ) == 0 :
8988 results .append (y )
9089 else :
You can’t perform that action at this time.
0 commit comments