- class Fair(dataset: pandas.DataFrame, estimator: sklearn.base.BaseEstimator)
Bases:
object
A class for increasing fair classification.
- Parameters:
dataset – (pd.DataFrame): Dataset for fairness correction.
estimator – (BaseEstimator): Classificator to be corrected that include fit/predict methods.
- run(number_iterations: int, prefit: bool = False, interior_classifier: str = 'rf', verbose: bool = False, multiplier: int = 1, random_state: int = 32) Dict[str, Any]
Correct fairness and calculate accuracy and fairness values
- Parameters:
number_iterations – (int) Number of iterations of interior algorithm
prefit – (bool) Flag if passed estimator fitted already or not (default: False)
interior_classifier – (str) One of following values: [‘rf’,’lr’,’dt’,’svm’,’knn’], meaning the name of interior classifier. (default: ‘rf’)
verbose – (bool) Flag for logging the information (default: False)
multiplier – (int) Size of subdataset, used in algorithm (default: 1)
random_state – (int) Seed for random state (default: None)
- Returns:
(dict): The dictionary with results: accuracy, fairness metrics (difference,variation, ratio) for both initial and fair classifiers, and the state of fitted model