-
Notifications
You must be signed in to change notification settings - Fork 783
Description
This is regarding this file:
https://github.com/interpretml/interpret/blame/master/python/interpret-core/interpret/data/response.py
MarginalExplanation.visualize(key) has a bug that prevents it from processing categorical features correctly. Changing the following lines will fix it:
move line #137:
bin_size = density_dict["names"][1] - density_dict["names"][0]
to be in the else (line #142)
if is_categorical:
trace1 = go.Histogram(x=data_dict["x"], name="x density", yaxis="y2")
else:
bin_size = density_dict["names"][1] - density_dict["names"][0]
trace1 = go.Histogram(
x=data_dict["x"],
name="x density",
yaxis="y2",
autobinx=False,
xbins=dict(
start=density_dict["names"][0],
end=density_dict["names"][-1],
size=bin_size,
),
)
and then move line 154:
resp_bin_size = density_dict["names"][1] - density_dict["names"][0]
create a new if statement, and put this line there: (line 157)
if is_categorical:
trace2 = go.Histogram(x=data_dict["y"], name="y density", xaxis="x2")
else:
resp_bin_size = density_dict["names"][1] - density_dict["names"][0]
trace2 = go.Histogram(
y=data_dict["y"],
name="y density",
xaxis="x2",
autobiny=False,
ybins=dict(
start=resp_density_dict["names"][0],
end=resp_density_dict["names"][-1],
size=resp_bin_size,
),
)
this would resolve the issue.