dice_ml package
Subpackages
- dice_ml.data_interfaces package
- Submodules
- dice_ml.data_interfaces.base_data_interface module
- dice_ml.data_interfaces.private_data_interface module
PrivateData
PrivateData.create_ohe_params()
PrivateData.de_normalize_data()
PrivateData.fit_label_encoders()
PrivateData.from_dummies()
PrivateData.from_label()
PrivateData.get_all_dummy_colnames()
PrivateData.get_data_params_for_gradient_dice()
PrivateData.get_decimal_precisions()
PrivateData.get_decoded_data()
PrivateData.get_encoded_categorical_feature_indexes()
PrivateData.get_features_range()
PrivateData.get_indexes_of_features_to_vary()
PrivateData.get_inverse_ohe_min_max_normalized_data()
PrivateData.get_mads()
PrivateData.get_minx_maxx()
PrivateData.get_ohe_min_max_normalized_data()
PrivateData.get_valid_feature_range()
PrivateData.get_valid_mads()
PrivateData.normalize_data()
PrivateData.one_hot_encode_data()
PrivateData.prepare_df_for_ohe_encoding()
PrivateData.prepare_query_instance()
PrivateData.query_instance_to_df()
- dice_ml.data_interfaces.public_data_interface module
PublicData
PublicData.create_ohe_params()
PublicData.de_normalize_data()
PublicData.fit_label_encoders()
PublicData.from_dummies()
PublicData.from_label()
PublicData.get_all_dummy_colnames()
PublicData.get_data_params_for_gradient_dice()
PublicData.get_data_type()
PublicData.get_decimal_precisions()
PublicData.get_decoded_data()
PublicData.get_encoded_categorical_feature_indexes()
PublicData.get_features_range()
PublicData.get_indexes_of_features_to_vary()
PublicData.get_inverse_ohe_min_max_normalized_data()
PublicData.get_mads()
PublicData.get_minx_maxx()
PublicData.get_ohe_min_max_normalized_data()
PublicData.get_quantiles_from_training_data()
PublicData.get_valid_feature_range()
PublicData.get_valid_mads()
PublicData.normalize_data()
PublicData.one_hot_encode_data()
PublicData.prepare_df_for_ohe_encoding()
PublicData.prepare_query_instance()
- Module contents
- dice_ml.explainer_interfaces package
- Submodules
- dice_ml.explainer_interfaces.dice_KD module
- dice_ml.explainer_interfaces.dice_genetic module
DiceGenetic
DiceGenetic.compute_loss()
DiceGenetic.compute_proximity_loss()
DiceGenetic.compute_sparsity_loss()
DiceGenetic.compute_yloss()
DiceGenetic.do_KD_init()
DiceGenetic.do_cf_initializations()
DiceGenetic.do_loss_initializations()
DiceGenetic.do_param_initializations()
DiceGenetic.do_random_init()
DiceGenetic.find_counterfactuals()
DiceGenetic.get_valid_feature_range()
DiceGenetic.label_decode()
DiceGenetic.label_decode_cfs()
DiceGenetic.label_encode()
DiceGenetic.mate()
DiceGenetic.predict_fn()
DiceGenetic.predict_fn_scores()
DiceGenetic.update_hyperparameters()
- dice_ml.explainer_interfaces.dice_pytorch module
DicePyTorch
DicePyTorch.compute_dist()
DicePyTorch.compute_diversity_loss()
DicePyTorch.compute_loss()
DicePyTorch.compute_proximity_loss()
DicePyTorch.compute_regularization_loss()
DicePyTorch.compute_yloss()
DicePyTorch.do_cf_initializations()
DicePyTorch.do_loss_initializations()
DicePyTorch.do_optimizer_initializations()
DicePyTorch.dpp_style()
DicePyTorch.find_counterfactuals()
DicePyTorch.get_model_output()
DicePyTorch.initialize_CFs()
DicePyTorch.predict_fn()
DicePyTorch.predict_fn_for_sparsity()
DicePyTorch.round_off_cfs()
DicePyTorch.stop_loop()
DicePyTorch.update_hyperparameters()
- dice_ml.explainer_interfaces.dice_random module
- dice_ml.explainer_interfaces.dice_tensorflow1 module
DiceTensorFlow1
DiceTensorFlow1.compute_dist()
DiceTensorFlow1.compute_diversity_loss()
DiceTensorFlow1.compute_proximity_loss()
DiceTensorFlow1.compute_regularization_loss()
DiceTensorFlow1.compute_yloss()
DiceTensorFlow1.do_cf_initializations()
DiceTensorFlow1.do_loss_initializations()
DiceTensorFlow1.do_optimizer_initializations()
DiceTensorFlow1.dpp_style()
DiceTensorFlow1.find_counterfactuals()
DiceTensorFlow1.generate_counterfactuals()
DiceTensorFlow1.initialize_CFs()
DiceTensorFlow1.predict_fn()
DiceTensorFlow1.predict_fn_for_sparsity()
DiceTensorFlow1.round_off_cfs()
DiceTensorFlow1.scipy_optimizers()
DiceTensorFlow1.stop_loop()
DiceTensorFlow1.tensorflow_optimizers()
DiceTensorFlow1.update_hyperparameters()
- dice_ml.explainer_interfaces.dice_tensorflow2 module
DiceTensorFlow2
DiceTensorFlow2.compute_dist()
DiceTensorFlow2.compute_diversity_loss()
DiceTensorFlow2.compute_loss()
DiceTensorFlow2.compute_proximity_loss()
DiceTensorFlow2.compute_regularization_loss()
DiceTensorFlow2.compute_yloss()
DiceTensorFlow2.do_cf_initializations()
DiceTensorFlow2.do_loss_initializations()
DiceTensorFlow2.do_optimizer_initializations()
DiceTensorFlow2.dpp_style()
DiceTensorFlow2.find_counterfactuals()
DiceTensorFlow2.generate_counterfactuals()
DiceTensorFlow2.initialize_CFs()
DiceTensorFlow2.predict_fn()
DiceTensorFlow2.predict_fn_for_sparsity()
DiceTensorFlow2.round_off_cfs()
DiceTensorFlow2.stop_loop()
DiceTensorFlow2.update_hyperparameters()
- dice_ml.explainer_interfaces.explainer_base module
ExplainerBase
ExplainerBase.build_KD_tree()
ExplainerBase.check_permitted_range()
ExplainerBase.check_query_instance_validity()
ExplainerBase.decide_cf_validity()
ExplainerBase.decode_model_output()
ExplainerBase.decode_to_original_labels()
ExplainerBase.deserialize_explainer()
ExplainerBase.do_binary_search()
ExplainerBase.do_linear_search()
ExplainerBase.do_posthoc_sparsity_enhancement()
ExplainerBase.feature_importance()
ExplainerBase.generate_counterfactuals()
ExplainerBase.get_model_output_from_scores()
ExplainerBase.global_feature_importance()
ExplainerBase.infer_target_cfs_class()
ExplainerBase.infer_target_cfs_range()
ExplainerBase.is_cf_valid()
ExplainerBase.local_feature_importance()
ExplainerBase.misc_init()
ExplainerBase.predict_fn()
ExplainerBase.predict_fn_for_sparsity()
ExplainerBase.round_to_precision()
ExplainerBase.serialize_explainer()
ExplainerBase.setup()
ExplainerBase.sigmoid()
- dice_ml.explainer_interfaces.feasible_base_vae module
- dice_ml.explainer_interfaces.feasible_model_approx module
- Module contents
- dice_ml.model_interfaces package
- dice_ml.schema package
- dice_ml.utils package
- Subpackages
- Submodules
- dice_ml.utils.exception module
- dice_ml.utils.helpers module
DataTransfomer
get_adult_data_info()
get_adult_income_modelpath()
get_base_gen_cf_initialization()
get_custom_dataset_modelpath_pipeline()
get_custom_dataset_modelpath_pipeline_binary()
get_custom_dataset_modelpath_pipeline_multiclass()
get_custom_dataset_modelpath_pipeline_regression()
get_custom_vars_dataset_modelpath_pipeline()
inverse_ohe_min_max_transformation()
load_adult_income_dataset()
load_custom_testing_dataset()
load_custom_testing_dataset_binary()
load_custom_testing_dataset_binary_str()
load_custom_testing_dataset_multiclass()
load_custom_testing_dataset_multiclass_str()
load_custom_testing_dataset_regression()
load_min_max_equal_dataset()
load_outcome_not_last_column_dataset()
ohe_min_max_transformation()
save_adult_income_model()
- dice_ml.utils.neuralnetworks module
- dice_ml.utils.serialize module
- Module contents
Submodules
dice_ml.constants module
Constants for dice-ml package.
- class dice_ml.constants.BackEndTypes[source]
Bases:
object
- ALL = ['sklearn', 'TF1', 'TF2', 'PYT']
- Pytorch = 'PYT'
- Sklearn = 'sklearn'
- Tensorflow1 = 'TF1'
- Tensorflow2 = 'TF2'
dice_ml.counterfactual_explanations module
- class dice_ml.counterfactual_explanations.CounterfactualExplanations(cf_examples_list, local_importance=None, summary_importance=None, version=None)[source]
Bases:
object
A class to store counterfactual examples for one or more inputs and feature importance scores.
- Parameters
cf_examples_list – A list of CounterfactualExamples instances
local_importance – List of estimated local importance scores. The size of the list is the number of input instances, each containing feature importance scores for that input.
summary_importance – Estimated global feature importance scores based on the input set of CounterfactualExamples instances
- property cf_examples_list
- property local_importance
- property metadata
- property summary_importance
dice_ml.data module
Module pointing to different implementations of Data class
DiCE requires only few parameters about the data such as the range of continuous features and the levels of categorical features. Hence, DiCE can be used for a private data whose meta data are only available (such as the feature names and range/levels of different features) by specifying appropriate parameters.
dice_ml.dice module
Module pointing to different implementations of DiCE based on different frameworks such as Tensorflow or PyTorch or sklearn, and different methods such as RandomSampling, DiCEKD or DiCEGenetic
- class dice_ml.dice.Dice(data_interface, model_interface, method='random', **kwargs)[source]
Bases:
ExplainerBase
An interface class to different DiCE implementations.
dice_ml.diverse_counterfactuals module
- class dice_ml.diverse_counterfactuals.CounterfactualExamples(data_interface=None, final_cfs_df=None, test_instance_df=None, final_cfs_df_sparse=None, posthoc_sparsity_param=0, desired_range=None, desired_class='opposite', model_type='classifier')[source]
Bases:
object
A class to store and visualize the resulting counterfactual explanations.
dice_ml.model module
Module pointing to different implementations of Model class
The implementations contain methods to access the output or gradients of ML models trained based on different frameworks such as Tensorflow or PyTorch.
Module contents
- class dice_ml.Data(**params)[source]
Bases:
_BaseData
Class containing all required information about the data for DiCE.
- class dice_ml.Dice(data_interface, model_interface, method='random', **kwargs)[source]
Bases:
ExplainerBase
An interface class to different DiCE implementations.