fairness.profile.plot {fairml} | R Documentation |
Profile Fair Models with Respect to Tuning Parameters
Description
Visually explore various aspect of a model over the range of possible values of the tuning parameters that control its fairness.
Usage
fairness.profile.plot(response, predictors, sensitive, unfairness,
legend = FALSE, type = "coefficients", model, model.args = list(), cluster)
Arguments
response |
a numeric vector, the response variable. |
predictors |
a numeric matrix or a data frame containing numeric and factor columns; the predictors. |
sensitive |
a numeric matrix or a data frame containing numeric and factor columns; the sensitive attributes. |
unfairness |
a vector of positive numbers in [0, 1], how unfair is the
model allowed to be. The default value is |
legend |
a logical value, whether to add a legend to the plot. |
type |
a character string, either |
model |
a character string, the label of the model. Currently
|
model.args |
additional arguments passed to model estimation. |
cluster |
an optional cluster object from package parallel, to fit models in parallel. |
Details
fairness.profile.plot()
fits the model for all the values of the
argument unfairness
, and produces a profile plot of the regression
coefficients or the proportion of explained variance.
If type = "coefficients"
, the coefficients of the model are plotted
against the values of unfairness
.
If type = "constraints"
, the following quantities are plotted against
the values of unfairness
:
For model
"nclm"
, and model"frrm"
withdefinition = "sp-komiyama"
:the proportion of variance explained by the sensitive attributes (with respect to the response);
the proportion of variance explained by the predictors (with respect to the response);
the proportion of variance explained by the sensitive attributes (with respect to the combined sensitive attributes and predictors).
For model
"frrm"
withdefinition = "eo-komiyama"
:the proportion of variance explained by the sensitive attributes (with respect to the fitted values);
the proportion of variance explained by the response (with respect to the fitted values);
the proportion of variance explained by the sensitive attributes (with respect to the combined sensitive attributes and response).
For model
"frrm"
withdefinition = "if-berk"
, the ratio between the individual fairness loss computed for a given values of the constraint and that of the unrestricted model withunfairness = 1
.For model
"fgrrm"
: same as for"frrm"
for eachdefinition
.For models
"zlm"
and"zlrm"
: the correlations between the fitted values (fromfitted()
withtype = "link"
) and the sensitive attributes.
If type = "precision-recall"
and the model
is a classifier, the
precision, recall and F1 measures are plotted against the values of
unfairness
.
If type = "rmse"
and the model
is a linear regression, the
residuals mean square error are plotted against the values of
unfairness
.
Value
A trellis
object containing a lattice plot.
Author(s)
Marco Scutari
Examples
data(vu.test)
fairness.profile.plot(response = vu.test$gaussian, predictors = vu.test$X,
sensitive = vu.test$S, type = "coefficients", model = "nclm", legend = TRUE)
fairness.profile.plot(response = vu.test$gaussian, predictors = vu.test$X,
sensitive = vu.test$S, type = "constraints", model = "nclm", legend = TRUE)
fairness.profile.plot(response = vu.test$gaussian, predictors = vu.test$X,
sensitive = vu.test$S, type = "rmse", model = "nclm", legend = TRUE)
# profile plots fitting models in parallel.
## Not run:
library(parallel)
cl = makeCluster(2)
fairness.profile.plot(response = vu.test$gaussian, predictors = vu.test$X,
sensitive = vu.test$S, model = "nclm", cluster = cl)
stopCluster(cl)
## End(Not run)