class_docstr: Linear bias mitigator. Mitigates bias in embeddings by removing component
  in the bias direction.
  
  !!! Note
      For a detailed walkthrough and visual descriptions of the steps, please
      refer to Figure 3 in [VERB: Visualizing and Interpreting Bias Mitigation Techniques
      for Word Representations](https://api.semanticscholar.org/CorpusID:233168618).
  
  Based on: S. Dev and J. M. Phillips. [Attenuating bias in word vectors]
  (https://api.semanticscholar.org/CorpusID:59158788).
  In International Conference on Artificial Intelligence and Statistics,
  Proceedings of Machine Learning Research, pages 879–887. PMLR, 2019.
  
  Implementation and terminology based on Rathore, A., Dev, S., Phillips, J.M., Srikumar,
  V., Zheng, Y., Yeh, C.M., Wang, J., Zhang, W., & Wang, B. (2021).
  [VERB: Visualizing and Interpreting Bias Mitigation Techniques for
  Word Representations](https://api.semanticscholar.org/CorpusID:233168618).
  ArXiv, abs/2104.02797.
docstr: !!! Note
      In the examples below, we treat gender identity as binary, which does not accurately
      characterize gender in real life.
  
  # Parameters
  
  evaluation_embeddings : `torch.Tensor`
      A tensor of size (batch_size, ..., dim) of embeddings for which to mitigate bias.
  bias_direction : `torch.Tensor`
      A unit tensor of size (dim, ) representing the concept subspace.
  
  !!! Note
      All tensors are expected to be on the same device.
  
  # Returns
  
  bias_mitigated_embeddings : `torch.Tensor`
      A tensor of the same size as evaluation_embeddings.
docstr_tok: ["!","!","!","Note","In","the","examples","below",",","we","treat","gender","identity","as","binary",",","which","does","not","accurately","characterize","gender","in","real","life",".","#","Parameters","evaluation_embeddings",":","`","torch.Tensor","`","A","tensor","of","size","(","batch_size",",","...",",","dim",")","of","embeddings","for","which","to","mitigate","bias",".","bias_direction",":","`","torch.Tensor","`","A","unit","tensor","of","size","(","dim",",",")","representing","the","concept","subspace",".","!","!","!","Note","All","tensors","are","expected","to","be","on","the","same","device",".","#","Returns","bias_mitigated_embeddings",":","`","torch.Tensor","`","A","tensor","of","the","same","size","as","evaluation_embeddings","."]
code: def __call__(
      self,
      evaluation_embeddings: torch.Tensor,
      bias_direction: torch.Tensor,
  ):
      """
  
      !!! Note
          In the examples below, we treat gender identity as binary, which does not accurately
          characterize gender in real life.
  
      # Parameters
  
      evaluation_embeddings : `torch.Tensor`
          A tensor of size (batch_size, ..., dim) of embeddings for which to mitigate bias.
      bias_direction : `torch.Tensor`
          A unit tensor of size (dim, ) representing the concept subspace.
  
      !!! Note
          All tensors are expected to be on the same device.
  
      # Returns
  
      bias_mitigated_embeddings : `torch.Tensor`
          A tensor of the same size as evaluation_embeddings.
      """
      # Some sanity checks
      if evaluation_embeddings.ndim < 2:
          raise ConfigurationError(
              "evaluation_embeddings must have at least two dimensions."
          )
      if bias_direction.ndim != 1:
          raise ConfigurationError(
              "bias_direction must be one-dimensional."
          )
      if evaluation_embeddings.size(-1) != bias_direction.size(-1):
          raise ConfigurationError(
              "All embeddings and bias_direction must have the same dimensionality."
          )
  
      with torch.set_grad_enabled(self.requires_grad):
          bias_direction = bias_direction / torch.linalg.norm(
              bias_direction
          )
          return self._remove_component(
              evaluation_embeddings, bias_direction
          )
  
imports: import torch
  import numpy
  import scipy
  import sklearn
  from allennlp.common.checks import ConfigurationError
label_desc: Use image node_id 1 for calling the LinearBiasMitigator obj's underlying member method code with example usage: obj.__call__(evaluation_embeddings, bias_direction) and returns: self