Skip to content

Commit

Permalink
Merge pull request #544 from guillaume-vignal/feature/compile_preds
Browse files Browse the repository at this point in the history
Feature/compile preds
  • Loading branch information
guillaume-vignal authored Mar 28, 2024
2 parents 2be43bd + f55414c commit 9110e95
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tests/unit_tests/explainer/test_smart_plotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ def setUp(self):
self.smart_explainer._case, self.smart_explainer._classes = check_model(model)
self.smart_explainer.state = MultiDecorator(SmartState())
self.smart_explainer.y_pred = None
self.smart_explainer.proba_values = None
self.smart_explainer.features_desc = dict(self.x_init.nunique())
self.smart_explainer.features_compacity = self.features_compacity

Expand Down Expand Up @@ -863,7 +864,7 @@ def test_contribution_plot_8(self):
xpl.model = model
np_hv = [f"Id: {x}<br />Predict: {y}" for x, y in zip(xpl.x_init.index, xpl.y_pred.iloc[:, 0].tolist())]
np_hv.sort()
output = xpl.plot.contribution_plot(col)
output = xpl.plot.contribution_plot(col, proba=False)
annot_list = []
for data_plot in output.data:
annot_list.extend(data_plot.hovertext.tolist())
Expand Down Expand Up @@ -895,7 +896,7 @@ def test_contribution_plot_9(self):
model = lambda: None
model.classes_ = np.array([0, 1])
xpl.model = model
output = xpl.plot.contribution_plot(col, max_points=39)
output = xpl.plot.contribution_plot(col, max_points=39, proba=False)
assert len(output.data) == 4
for elem in output.data:
assert elem.type == "violin"
Expand Down Expand Up @@ -1266,6 +1267,9 @@ def test_features_importance_4(self):

def test_local_pred_1(self):
xpl = self.smart_explainer
xpl.proba_values = pd.DataFrame(
data=np.array([[0.4, 0.6], [0.3, 0.7]]), columns=["class_1", "class_2"], index=xpl.x_encoded.index.values
)
output = xpl.plot.local_pred("person_A", label=0)
assert isinstance(output, float)

Expand Down

0 comments on commit 9110e95

Please sign in to comment.