CIFRank¶
- @article{yang2020causal,
title={Causal intersectionality for fair ranking}, author={Yang, Ke and Loftus, Joshua R and Stoyanovich, Julia}, journal={arXiv preprint arXiv:2006.08688}, year={2020}
}
License Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- class fairdiverse.search.preprocessing_model.CIFRank.CIFRank(configs, dataset)[source]¶
Bases:
PreprocessingFairnessIntervention
CIFRank class implements a fairness intervention method using causal intersectionality.
This class extends the PreprocessingFairnessIntervention class and applies a causal fairness ranking model to the given dataset.
- fit(X_train, run)[source]¶
Train the causal fairness ranking model on the given training dataset.
This method ensures that the necessary model directory exists and then runs the causal model. The trained model is saved in self.model_path.
- :param X_trainpandas.DataFrame
The training dataset.
- :param runstr
The identifier for the training run.
:return : None
- generate_counterfactual_data(X, run)[source]¶
Generates the fair data by using the causal estimates :param data: data on which to append the fair columns :type data: pandas.Dataframe
- Returns:
data containing the appended fair columns which contain the counterfactual values computed based on the causal estimates
- Return type:
data (pandas.Dataframe)
- transform(X, run, file_name=None)[source]¶
Apply the fairness transformation to the dataset by generating fair counterfactual columns.
Fair columns are generated using a naming convention <column_name>_fair and saved to a CSV file if it does not already exist.
- :param Xpandas.DataFrame
The dataset to which the fairness method should be applied.
- :param runstr
The identifier for the transformation run.
- :param file_namestr, optional
Name of the file to save the transformed dataset.
- :returnpandas.DataFrame
The dataset with appended fair columns.