dice_ml.data_interfaces package

Submodules

dice_ml.data_interfaces.private_data_interface module

Module containing meta data information about private data.

class dice_ml.data_interfaces.private_data_interface.PrivateData(params)[source]

Bases: object

A data interface for private data with meta information.

de_normalize_data(df)[source]

De-normalizes continuous features from [0,1] range to original range.

from_dummies(data, prefix_sep='_')[source]

Gets the original data from dummy encoded data with k levels.

get_data_params()[source]

Gets all data related params for DiCE.

get_decimal_precisions()[source]

“Gets the precision of continuous features in the data.

get_decoded_data(data)[source]

Gets the original data from dummy encoded data.

get_dev_data(model_interface, desired_class, filter_threshold=0.5)[source]

Constructs dev data by extracting part of the test data for which finding counterfactuals make sense.

get_encoded_categorical_feature_indexes()[source]

Gets the column indexes categorical features after one-hot-encoding.

get_indexes_of_features_to_vary(features_to_vary='all')[source]

Gets indexes from feature names of one-hot-encoded data.

get_mads(normalized=True)[source]

Computes Median Absolute Deviation of features.

get_minx_maxx(normalized=True)[source]

Gets the min/max value of features in normalized or de-normalized form.

get_valid_mads(normalized=False, display_warnings=False, return_mads=True)[source]

Computes Median Absolute Deviation of features. If they are <=0, returns a practical value instead

normalize_data(df)[source]

Normalizes continuous features to make them fall in the range [0,1].

one_hot_encode_data(data)[source]

One-hot-encodes the data.

prepare_df_for_encoding()[source]

Facilitates get_test_inputs() function.

prepare_query_instance(query_instance, encode)[source]

Prepares user defined test input for DiCE.

dice_ml.data_interfaces.public_data_interface module

Module containing all required information about the raw or transformed public data.

class dice_ml.data_interfaces.public_data_interface.PublicData(params)[source]

Bases: object

A data interface for public data.

check_features_range()[source]
de_normalize_data(df)[source]

De-normalizes continuous features from [0,1] range to original range.

from_dummies(data, prefix_sep='_')[source]

Gets the original data from dummy encoded data with k levels.

get_data_params()[source]

Gets all data related params for DiCE.

get_data_type(col)[source]

Infers data type of a feature from the training data.

get_decimal_precisions()[source]

“Gets the precision of continuous features in the data.

get_decoded_data(data)[source]

Gets the original data from dummy encoded data.

get_dev_data(model_interface, desired_class, filter_threshold=0.5)[source]

Constructs dev data by extracting part of the test data for which finding counterfactuals make sense.

get_encoded_categorical_feature_indexes()[source]

Gets the column indexes categorical features after one-hot-encoding.

get_features_range()[source]
get_indexes_of_features_to_vary(features_to_vary='all')[source]

Gets indexes from feature names of one-hot-encoded data.

get_mads(normalized=False)[source]

Computes Median Absolute Deviation of features.

get_minx_maxx(normalized=True)[source]

Gets the min/max value of features in normalized or de-normalized form.

get_quantiles_from_training_data(quantile=0.05, normalized=False)[source]

Computes required quantile of Absolute Deviations of features.

get_valid_mads(normalized=False, display_warnings=False, return_mads=True)[source]

Computes Median Absolute Deviation of features. If they are <=0, returns a practical value instead

normalize_data(df)[source]

Normalizes continuous features to make them fall in the range [0,1].

one_hot_encode_data(data)[source]

One-hot-encodes the data.

prepare_df_for_encoding()[source]

Facilitates prepare_query_instance() function.

prepare_query_instance(query_instance, encode)[source]

Prepares user defined test input for DiCE.

split_data(data)[source]

Module contents