DiCE icon indicating copy to clipboard operation
DiCE copied to clipboard

error "unexpected keyword argument 'desired_range'" for TF regression models

Open ddefranza opened this issue 3 years ago • 4 comments

Hello,

I have a DNN model built in Keras and TensorFlow with a regression output. When I call the generate_counterfactuals function, I receive the error:

TypeError: generate_counterfactuals() got an unexpected keyword argument 'desired_range'

The code that generates the error is:

backend = "TF" + tf.__version__[0]  # TF2

dice_data = dice_ml.Data(dataframe=dice_data, continuous_features=features, outcome_name=outcome)

dnn_dice = dice_ml.Model(model=dnn_model, backend=backend, model_type="regressor")

dice_cf = exp.generate_counterfactuals(query_instance=X_test[:1000], total_CFs=2, desired_range=[0.01, 0.1])

System info: Google Colab Python 3.7.13 dice-ml 0.7.2 keras 2.8.0 tensorflow 2.8.0

ddefranza avatar May 09 '22 20:05 ddefranza

@ddefranza it looks like we don't support desired_range for TF2. @amit-sharma are there any plans to support regression for TF2 models soon?

gaugup avatar May 10 '22 01:05 gaugup

yeah, this is a work-in-progress for TF models. At this point, it might be end-June by which we can support this.

amit-sharma avatar May 10 '22 05:05 amit-sharma

Hello, it's not able to use "desired range" for TF models. Will it be available soon? @amit-sharma

mhdpr avatar Aug 29 '23 03:08 mhdpr

this got deprioritized, unfortunately. We welcome contributions--if you would like to contribute, that will be great.

amit-sharma avatar Aug 29 '23 04:08 amit-sharma