Skip to content

"feature_weights" not working #443

Description

@DarthZonke

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

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions