inFairness.fairalgo.sensr module#

class inFairness.fairalgo.sensr.SenSR(network, distance_x, loss_fn, eps, lr_lamb, lr_param, auditor_nsteps, auditor_lr)[source]#

Bases: Module

Implementes the Sensitive Subspace Robustness (SenSR) algorithm.

Proposed in Training individually fair ML models with sensitive subspace robustness

Parameters:
  • network (torch.nn.Module) – Network architecture

  • distance_x (inFairness.distances.Distance) – Distance metric in the input space

  • loss_fn (torch.nn.Module) – Loss function

  • eps (float) – \(\epsilon\) parameter in the SenSR algorithm

  • lr_lamb (float) – \(\lambda\) parameter in the SenSR algorithm

  • lr_param (float) – \(\alpha\) parameter in the SenSR algorithm

  • auditor_nsteps (int) – Number of update steps for the auditor to find worst-case examples

  • auditor_lr (float) – Learning rate for the auditor

forward(X, Y=None, *args, **kwargs)[source]#

Defines the computation performed at every call.

Parameters:
Returns:

output – Model output

Return type:

torch.Tensor

forward_test(X)[source]#

Forward method during the test phase

forward_train(X, Y)[source]#

Forward method during the training phase

training: bool#