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_weights" not working #443

Open
DarthZonke opened this issue Aug 24, 2024 · 0 comments
Open

"feature_weights" not working #443

DarthZonke opened this issue Aug 24, 2024 · 0 comments

Comments

@DarthZonke
Copy link

DarthZonke commented Aug 24, 2024

I cannot use "feature_weights" on DICE, I am getting the error below, please assist:

Code:
query_instance = denied_loans.drop(columns="predicted")
dice_exp = exp.generate_counterfactuals(query_instance,
total_CFs=1,
desired_class="opposite",
features_to_vary=vary_feature,
proximity_weight=1,
diversity_weight=0,
categorical_penalty=1, .
feature_weights=feature_weights,
random_seed=42,
verbose=True,
method="genetic")

dice_exp.visualize_as_dataframe()

Error:


TypeError Traceback (most recent call last)
in <cell line: 2>()
1 query_instance = denied_loans.drop(columns="predicted")
----> 2 dice_exp = exp.generate_counterfactuals(query_instance,
3 total_CFs=1,
4 desired_class="opposite",
5 features_to_vary=vary_feature,

/usr/local/lib/python3.10/dist-packages/dice_ml/explainer_interfaces/explainer_base.py in generate_counterfactuals(self, query_instances, total_CFs, desired_class, desired_range, permitted_range, features_to_vary, stopping_threshold, posthoc_sparsity_param, proximity_weight, sparsity_weight, diversity_weight, categorical_penalty, posthoc_sparsity_algorithm, verbose, **kwargs)
184 for query_instance in tqdm(query_instances_list):
185 self.data_interface.set_continuous_feature_indexes(query_instance)
--> 186 res = self._generate_counterfactuals(
187 query_instance, total_CFs,
188 desired_class=desired_class,

TypeError: DiceRandom._generate_counterfactuals() got an unexpected keyword argument 'feature_weights

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant