This repository introduces a novel variation of the GridSearchCV algorithm from scikit-learn, uniquely designed to optimize machine learning models not only for accuracy but also for fairness metrics. This project addresses the critical need for unbiased models in machine learning, especially in sensitive domains like healthcare, recidivism prediction, mortgage lending, and income-based financial decisions.
- Enhanced GridSearch Algorithm: Extends
sklearn'sGridSearchCVto evaluate and optimize both accuracy and bias metrics simultaneously. - Bias Metrics Integration: Incorporates key bias metrics like demographic parity, equalized odds, and others, ensuring models are fair and equitable.
- Domain-Specific Applications: Provides practical implementations in four critical domains:
- Healthcare: Improving diagnostic fairness.
- Recidivism: Ensuring unbiased risk assessments.
- Mortgage: Facilitating fair lending practices.
- Finance: Promoting equity in income-related decisions.
To replicate our environment, you can choose from the following options. Regardless of which option, in order to explore our work:
-
Clone the repository:
git clone https://github.com/474benchen/biased_gridsearch.git -
Navigate to the project directory:
cd biased_gridsearch
Ensure that you have pip installed before attempting this option. Instructions can be found here.
-
Install the required packages using pip:
pip install -r requirements.txt -
Proceed to the next steps for data setup.
Ensure that you have conda installed before attempting this option. Distributions can be found here.
-
Create a conda environment from the provided environment.yml file:
conda env create -f environment.yml -
Activate the conda environment:
conda activate biased_gs -
Proceed to the next steps for data setup.
For each example, data has been provided in the same directory.
This section provides examples of how to apply the Enhanced GridSearchCV in each of the four domains. Please refer to the respective folders for detailed notebooks:
/healthcare_example/recidivism_example/mortgage_example/finance_example