Skip to content

Support for multiple sensitive features in Fairness dashboard #478

@michaelamoako

Description

@michaelamoako

Need by_group (currently in MetricFrame) in the Fairness dashboard. Found a temporary workaround (described below)

#sensitive_features is a list of the sensitive columns in the pandas dataframe (named pdf), golden labels corresponds to the column of ground truth labels in the pdf, and predictions corresponds to the predictions of the classifier 

sensitive_cols=pdf.loc[:][sensitive_features]

`def append_cols(grouped_col, pdf, cols):
    pdf[grouped_col] = ["" for i in range(len(cols))]
    for col in cols: 
        pdf[grouped_col] += cols[col]
        
sensitive_features_grouped = "-".join(sensitive_features)
append_cols(sensitive_features_grouped, pdf, sensitive_cols)  
#Now the pdf has the new column that is a combination of the sensitive features `

FairnessDashboard(sensitive_features=pdf[sensitive_features_grouped],
                y_true=golden_labels,
                y_pred=predictions)`

Note: sensitive_cols can also be modified to see the grouped column, in addition to other sensitive columns

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions