dice_ml package

Submodules

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.

class dice_ml.data.Data(**params)[source]

Bases: object

Class containing all required information about the data for DiCE.

decide_implementation_type(params)[source]

Decides if the Data class is for public or private data.

dice_ml.data.decide(params)[source]

Decides if the Data class is for public or private data.

dice_ml.dice module

Module pointing to different implementations of DiCE based on different frameworks such as Tensorflow or PyTorch.

class dice_ml.dice.Dice(data_interface, model_interface, **kwargs)[source]

Bases: object

An interface class to different DiCE implementations.

decide_implementation_type(data_interface, model_interface, **kwargs)[source]

Decides DiCE implementation type.

dice_ml.dice.decide(data_interface, model_interface)[source]

Decides DiCE implementation type.

dice_ml.diverse_counterfactuals module

class dice_ml.diverse_counterfactuals.CounterfactualExamples(data_interface, test_instance, test_pred, final_cfs, final_cfs_preds, final_cfs_sparse=None, cfs_preds_sparse=None, posthoc_sparsity_param=0, desired_class='opposite')[source]

Bases: object

A class to store and visualize the resulting counterfactual explanations.

convert_to_dataframe()[source]
convert_to_dataframe_sparse()[source]
display_df(df, show_only_changes)[source]
print_list(li, show_only_changes)[source]
visualize_as_dataframe(display_sparse_df=True, show_only_changes=False)[source]
visualize_as_list(display_sparse_df=True, show_only_changes=False)[source]

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.

class dice_ml.model.Model(model=None, model_path='', backend='TF1')[source]

Bases: object

An interface class to different ML Model implementations.

decide_implementation_type(model, model_path, backend)[source]

Decides the Model implementation type.

dice_ml.model.decide(backend)[source]

Decides the Model implementation type.

Module contents