File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed
omnixai/explainers/tabular/counterfactual/mace Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change 4
4
# SPDX-License-Identifier: BSD-3-Clause
5
5
# For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
6
#
7
- import numpy as np
8
7
import pandas as pd
9
8
from typing import Dict , Callable , Union
10
9
@@ -45,7 +44,7 @@ def _refine(
45
44
46
45
for col , (a , b ) in cont_features .items ():
47
46
gap , r = b - a , None
48
- while (b - a ) / ( gap + 1e-3 ) > 0.1 :
47
+ while (b - a ) / gap > 0.1 :
49
48
z = (a + b ) * 0.5
50
49
y .iloc [0 , column2loc [col ]] = z
51
50
scores = predict_function (Tabular (data = y , categorical_columns = instance .categorical_columns ))[0 ]
@@ -83,8 +82,8 @@ def refine(
83
82
cont_features = {}
84
83
for col in self .cont_columns :
85
84
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 )
88
87
if len (cont_features ) == 0 :
89
88
results .append (y )
90
89
else :
You can’t perform that action at this time.
0 commit comments