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

Unexpected Behavior in Calculating ”feature_weight_list“ leads to abnormal loss? #411

Open
Siki-cloud opened this issue Oct 19, 2023 · 0 comments

Comments

@Siki-cloud
Copy link

Siki-cloud commented Oct 19, 2023

Description:
I am currently working with a 2D dataset. I have a sample point, x[f1, f2], where f1 and f2 are continuous real values. I am training a linear regression model and using the Dice gradient method for explanation. I have not applied any preprocessing transformations to the data. Here's my code:

d = dice_ml.Data(dataframe=x_train, continuous_features=['f1', 'f2'], outcome_name='tag')
m = dice_ml.Model(model=model, backend='PYT')
dice_exp = dice_ml.Dice(d, m, method='gradient')
cfs = dice_exp.generate_counterfactuals(query_instance, total_CFs=4, posthoc_sparsity_param=None)
cfs.visualize_as_dataframe(show_only_changes=True)

However, I'm facing issues where the loss is rapidly increasing, and I'm not getting any counterfactual results.

Upon further investigation, I found that this might be related to the "proximity_loss." Specifically, the "feature_weight_list" is calculated based on continuous features that have been scaled to the [0, 1] range, leading to extremely large values for proximity_loss.

However, when I attempted to calculate the Mean Absolute Deviation (MAD) using the original unscaled data and obtained the feature_weight_list from it, I found that the loss was normal, and I could successfully find counterfactual explanations.

So I want to ask, is this method of calculating feature weights reasonable? In other words, shouldn't MAD be calculated using scaled values if the user does not specify the preprocessing transformer, i.e., func=None?
(PS* some running details are shown as below)

gradient dice - abnormal loss
redice - normal loss

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