Description Usage Arguments Value Examples
Calculates Statistical Parity ((TP+FP)/(TP+FP+TN+FN)) ratio between privileged and discriminated label for given model, which is one of the most important fairness metrics for us, because it measures how similar the distributions of sensitive values are.
1 | calc_STP(model, test_ds, sensitive, dev)
|
model |
net, nn_module, neural network model we want to evaluate |
test_ds |
|
sensitive |
numerical vector of sensitive variable |
dev |
device used for calculations (cpu or gpu) |
float, STP ratio
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ## Not run:
dev <- "cpu"
# presaved torch model
model <- torch_load(system.file("extdata","clf2",package="fairpan"))
# presaved output of preprocess function
processed <- torch_load(system.file("extdata","processed",package="fairpan"))
dsl <- dataset_loader(processed$train_x, processed$train_y,
processed$test_x, processed$test_y,
batch_size = 5, dev = dev)
calc_STP(model, dsl$test_ds, processed$sensitive_test, dev)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.