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.
# 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
Release history Release notifications | RSS feed
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.9.tar.gz
(11.2 kB
view details)
Built Distribution
File details
Details for the file hbac_bias_detection-0.1.9.tar.gz
.
File metadata
- Download URL: hbac_bias_detection-0.1.9.tar.gz
- Upload date:
- Size: 11.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d70cc725985527df8b510c0ff1b17b50982e824584c70e592d8a10a6fa4d3698 |
|
MD5 | b40d5b96423be1a1f649e1e3a888234e |
|
BLAKE2b-256 | b04c8c92db1745b1ee0c3ef1097f74a5b50859d89c390e3636b27c79acda444e |
File details
Details for the file hbac_bias_detection-0.1.9-py2.py3-none-any.whl
.
File metadata
- Download URL: hbac_bias_detection-0.1.9-py2.py3-none-any.whl
- Upload date:
- Size: 12.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b2cd746f2aceaea6ffaf555aadb60ce09134baab281501ff4f55a1a8aebc14fa |
|
MD5 | 36fc2bf657125333f33106bd90f748f0 |
|
BLAKE2b-256 | c77b331c34247edf337b9958b91ea50229b5ee1562871335eb707f570e7e2f3d |