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

using fairness_check_regression() with an equation instead of model object #52

Open aminadibi opened 11 months ago

aminadibi commented 11 months ago

fairness_check_regression() requires a DALEX explainer as input. To create a DALEX explainer, one needs a model object. Imagine, I am getting a regression equation from a paper and I want to look into fairness of it with a dataset. I did not fit the regression myself, and thus don't have a model object. How can I create an explainer from an arbitrary R function that uses a formula (or whatever) to produce the predictions of the regression model?

Thanks

jakwisn commented 11 months ago

Hi, I think what you need is to make a custom DALEX explainer from the function. I found this piece of code in the DALEX documentation:

# simple function
aps_fun <- function(x) 58*x$surface
aps_fun_explainer <- explain(aps_fun, data = apartments, y = apartments$m2.price, label="sfun")
model_performance(aps_fun_explainer)

Could this approach work in your scenario?