fairmodels icon indicating copy to clipboard operation
fairmodels copied to clipboard

using fairness_check_regression() with an equation instead of model object

Open aminadibi opened this issue 2 years ago • 1 comments

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

aminadibi avatar Nov 14 '23 19:11 aminadibi

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?

jakwisn avatar Nov 28 '23 19:11 jakwisn