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.

github_workflow drawio

# 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)

# Get discriminated data in panda df
hbac.all_unscaled_discriminated

# 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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

hbac_bias_detection-0.2.2-py2.py3-none-any.whl (13.0 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

File hashes

Hashes for hbac_bias_detection-0.2.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 f201aa618226da7b503c650ff1f8adc06cc7d37add8b1c13c6ffc39445ca41e3
MD5 a51a6604aa55a74c101ab4ca3d806ed1
BLAKE2b-256 3cf7ffc5cd5e73028424504e0f1dff3ab112ca939469f6c12fa01e6e336d921d

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