Skip to main content

No project description provided

Project description

Using HBAC to detect biased data segments

  • Hierarchical Bias-Aware Clustering (HBAC) on regression models.
  • Input: a trained model and a model's test data.
  • Output: analysis of biased/discriminated data segment according to HBAC:
    • Comparing distributions of discriminated and remaining data.
    • Segment predictor: trains a XGBoost binary classifier to evaluate distinguishability of discriminated and remaining data with descriptive features.

alt text

# Initialize HBAC 
hbac = HBAC_analyser()

# In this case, input includes model path, X data and Y data
hbac.hbac_on_model(model_path, X_test, y_test) 

hbac.pca_plot()
discrimated_cluster, bias =  hbac.get_max_bias_cluster(print_results=True)

# Displaying results in dataframes
hbac.clustered_data

# Mean per feature 'discrimnated' cluster vs 'remaining' clusters
hbac.mean_clusters

# Plot 3 most different features' distributions
hbac.plot_distributions(plot_top_features = 3)

# Train XGBoost a binary classifier to predict whther a datapoint will be discrimnated or not, without using error as feature.
hbac.segment_predictor(plot_roc_auc=True,shap_analysis=True)

Also see example.ipynb.

For the use of HBAC on classification models, see https://github.com/Sm2468/msc_thesis/tree/master/hbac%20scripts, on which this project was based.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hbac_bias_detection-0.1.6.tar.gz (853.2 kB view details)

Uploaded Source

Built Distribution

hbac_bias_detection-0.1.6-py2.py3-none-any.whl (1.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file hbac_bias_detection-0.1.6.tar.gz.

File metadata

  • Download URL: hbac_bias_detection-0.1.6.tar.gz
  • Upload date:
  • Size: 853.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.2

File hashes

Hashes for hbac_bias_detection-0.1.6.tar.gz
Algorithm Hash digest
SHA256 e7f2134ca1c2d8cd37bbb8cb58d0102c6ee99d64920d48b606441a6086a92350
MD5 78b47a29a8452ec2dcb342c931d963ca
BLAKE2b-256 2716e158555e2ea270301932ebd56f6bc39464c018f9ec2877b5919791904845

See more details on using hashes here.

File details

Details for the file hbac_bias_detection-0.1.6-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for hbac_bias_detection-0.1.6-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 85472b7896bcbf9a8de5385616d8e55b9afc972765c28c9ce694aca9e94ce2d0
MD5 2e4c530c0d42e250e4a89f8fe9b49d2b
BLAKE2b-256 3bdf5cd1bf0d6b7d107bcbf57905b91b9b28ce26f9d2f3465bea0b3de9eca25a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page