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

Update requirements.txt to upgrade dice-ml to 0.11.0 #2397

Merged
merged 5 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion responsibleai/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
dice-ml>=0.10,<0.11
dice-ml>=0.11,<0.12
econml>=0.14.1
gaugup marked this conversation as resolved.
Show resolved Hide resolved
statsmodels<0.14.0
jsonschema
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,15 @@ class TestCounterfactualAdvancedFeatures(object):

@pytest.mark.parametrize('vary_all_features', [True, False])
@pytest.mark.parametrize('feature_importance', [True, False])
@pytest.mark.parametrize('encode_target_as_strings', [True, False])
def test_counterfactual_vary_features(
self, vary_all_features, feature_importance):
self, vary_all_features, feature_importance,
encode_target_as_strings):
X_train, X_test, y_train, y_test, feature_names, _ = \
create_iris_data()
if encode_target_as_strings:
y_train = y_train.astype(str)
y_test = y_test.astype(str)

model = create_lightgbm_classifier(X_train, y_train)
X_train['target'] = y_train
Expand All @@ -50,6 +55,23 @@ def test_counterfactual_vary_features(

cf_obj = rai_insights.counterfactual.get()[0]
assert cf_obj is not None
for index in range(0, len(cf_obj.cf_examples_list)):
assert isinstance(
cf_obj.cf_examples_list[
index].test_instance_df[
'target'].values[0], str) == encode_target_as_strings

assert cf_obj.cf_examples_list[
index].test_instance_df['target'].values[0] in set(
y_train)

cf_target_array = cf_obj.cf_examples_list[0].final_cfs_df[
'target'].values
for inner_index in range(0, 10):
assert isinstance(
cf_target_array[
inner_index], str) == encode_target_as_strings
assert cf_target_array[inner_index] in set(y_train)

@pytest.mark.parametrize('feature_importance', [True, False])
def test_counterfactual_permitted_range(self, feature_importance):
Expand Down
Loading