fairlib.src.dataloaders.BT

fairlib.src.dataloaders.BT

fairlib.src.dataloaders.BT.get_sampled_indices(BTObj, y, protected_label, method='Downsampling')

Given the balanced training objective, target labels, and protected labels, sampling instances for each group.

Parameters
  • BTObj (str) – y| g | joint | stratified_y | stratified_g | EO.

  • y (list) – a list of target labels.

  • protected_label (list) – a list of protected labels.

  • method (str, optional) – Downsampling | Resampling. Defaults to “Downsampling”.

Returns

a list of indices of selected instacnes.

Return type

list

fairlib.src.dataloaders.BT.get_weights(BTObj, y, protected_label)

Given the balanced training objective, target labels, and protected labels, pre-calculate weights for each instance.

Parameters
  • BTObj (str) – y| g | joint | stratified_y | stratified_g | EO.

  • y (list) – a list of target labels.

  • protected_label (list) – a list of protected labels.

Returns

instance weights w.r.t. the balanced training objective.

Return type

list