Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/compile preds #544

Merged
merged 3 commits into from
Mar 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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