fairness.profile.plot function

Profile Fair Models with Respect to Tuning Parameters

Profile Fair Models with Respect to Tuning Parameters

Visually explore various aspect of a model over the range of possible values of the tuning parameters that control its fairness.

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 seq(from = 0.00, to = 1, by = 0.02).

  • legend: a logical value, whether to add a legend to the plot.

  • type: a character string, either "coefficients" (the default), "constraints", "precision-recall" or "rmse".

  • model: a character string, the label of the model. Currently "nclm", "frrm", "fgrrm", "zlm" and "zlrm"

    are available.

  • 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:

  1. For model "nclm", and model "frrm" with definition = "sp-komiyama":

    1. the proportion of variance explained by the sensitive attributes (with respect to the response);
    2. the proportion of variance explained by the predictors (with respect to the response);
    3. the proportion of variance explained by the sensitive attributes (with respect to the combined sensitive attributes and predictors).
  2. For model "frrm" with definition = "eo-komiyama":

    1. the proportion of variance explained by the sensitive attributes (with respect to the fitted values);
    2. the proportion of variance explained by the response (with respect to the fitted values);
    3. the proportion of variance explained by the sensitive attributes (with respect to the combined sensitive attributes and response).
  3. For model "frrm" with definition = "if-berk", the ratio between the individual fairness loss computed for a given values of the constraint and that of the unrestricted model with unfairness = 1.

  4. For model "fgrrm": same as for "frrm" for each definition.

  5. For models "zlm" and "zlrm": the correlations between the fitted values (from fitted() with type = "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.

Returns

A trellis object containing a lattice plot.

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)

Author(s)

Marco Scutari

  • Maintainer: Marco Scutari
  • License: MIT + file LICENSE
  • Last published: 2023-05-13

Useful links