dice_ml.utils package

Subpackages

Submodules

dice_ml.utils.exception module

Exceptions for the package.

exception dice_ml.utils.exception.SystemException[source]

Bases: Exception

An exception indicating that some system exception happened during execution.

Parameters

exception_message (str) – A message describing the error.

dice_ml.utils.helpers module

This module containts helper functions to load data and get meta deta.

class dice_ml.utils.helpers.DataTransfomer(func=None, kw_args=None)[source]

Bases: object

A class to transform data based on user-defined function to get predicted outcomes. This class calls FunctionTransformer of scikit-learn internally (https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.FunctionTransformer.html).

feed_data_params(data_interface)[source]
initialize_transform_func()[source]
inverse_transform(data)[source]
transform(data)[source]
dice_ml.utils.helpers.get_adult_data_info()[source]
dice_ml.utils.helpers.get_adult_income_modelpath(backend='TF1')[source]
dice_ml.utils.helpers.get_base_gen_cf_initialization(data_interface, encoded_size, cont_minx, cont_maxx, margin, validity_reg, epochs, wm1, wm2, wm3, learning_rate)[source]
dice_ml.utils.helpers.get_custom_dataset_modelpath_pipeline()[source]
dice_ml.utils.helpers.get_custom_dataset_modelpath_pipeline_binary()[source]
dice_ml.utils.helpers.get_custom_dataset_modelpath_pipeline_multiclass()[source]
dice_ml.utils.helpers.get_custom_dataset_modelpath_pipeline_regression()[source]
dice_ml.utils.helpers.get_custom_vars_dataset_modelpath_pipeline()[source]
dice_ml.utils.helpers.inverse_ohe_min_max_transformation(data, data_interface)[source]
dice_ml.utils.helpers.load_adult_income_dataset(only_train=True)[source]
Loads adult income dataset from https://archive.ics.uci.edu/ml/datasets/Adult and prepares

the data for data analysis based on https://rpubs.com/H_Zhu/235617

Return adult_data

returns preprocessed adult income dataset.

dice_ml.utils.helpers.load_custom_testing_dataset()[source]
dice_ml.utils.helpers.load_custom_testing_dataset_binary()[source]
dice_ml.utils.helpers.load_custom_testing_dataset_binary_str()[source]
dice_ml.utils.helpers.load_custom_testing_dataset_multiclass()[source]
dice_ml.utils.helpers.load_custom_testing_dataset_multiclass_str()[source]
dice_ml.utils.helpers.load_custom_testing_dataset_regression()[source]
dice_ml.utils.helpers.load_min_max_equal_dataset()[source]
dice_ml.utils.helpers.load_outcome_not_last_column_dataset()[source]
dice_ml.utils.helpers.ohe_min_max_transformation(data, data_interface)[source]

the data is one-hot-encoded and min-max normalized and fed to the ML model

dice_ml.utils.helpers.save_adult_income_model(modelpath, test_fraction=0.2, random_state=0)[source]

dice_ml.utils.neuralnetworks module

class dice_ml.utils.neuralnetworks.FFNetwork(*args: Any, **kwargs: Any)[source]

Bases: Module

forward(x)[source]
class dice_ml.utils.neuralnetworks.MulticlassNetwork(*args: Any, **kwargs: Any)[source]

Bases: Module

forward(x)[source]

dice_ml.utils.serialize module

class dice_ml.utils.serialize.DummyDataInterface(outcome_name, data_df=None)[source]

Bases: object

to_json()[source]

Module contents