ModelOriented / fairmodels

Flexible tool for bias detection, visualization, and mitigation
https://fairmodels.drwhy.ai/
GNU General Public License v3.0
86 stars 15 forks source link

Disparact_impact_remover #50

Closed noorazhaoz closed 1 year ago

noorazhaoz commented 1 year ago

I tried different datasets, the following error always occurred,

Screenshot 2023-02-22 at 19 54 43

jakwisn commented 1 year ago

Hi @noora-maki! Can you provide a working snippet of code where an error could be reproduced?

noorazhaoz commented 1 year ago

Hi @noora-maki! Can you provide a working snippet of code where an error could be reproduced?

Thanks for response.

I just imported the dataset (attached). 1.xlsx The protected attribute is sex,

X1$sex <- as.factor(X1$sex)

and then try applying pre-processing techniques to this dataset,

X1_changed <- disparate_impact_remover( data = X1, protected = X1$sex, features_to_transform = 'age', lambda = 1 ) Then the error occurred. Screenshot 2023-02-23 at 09 36 26

jakwisn commented 1 year ago

@noora-maki data must be in the form of a dataframe. Try doing

X1 <- as.data.frame(read_excel("1.xlsx"))   

Hope it helps

noorazhaoz commented 1 year ago

Thanks! That works!! I'll close it. Thanks a million.