inFairness.fairalgo.sensei module#

class inFairness.fairalgo.sensei.SenSeI(network, distance_x, distance_y, loss_fn, rho, eps, auditor_nsteps, auditor_lr)[source]#

Bases: Module

Implementes the Sensitive Set Invariane (SenSeI) algorithm.

Proposed in SenSeI: Sensitive Set Invariance for Enforcing Individual Fairness

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

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

  • distance_y (inFairness.distances.Distance) – Distance metric in the output space

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

  • rho (float) – \(\rho\) parameter in the SenSR algorithm

  • eps (float) – \(\epsilon\) 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#