class_docstr: A filterer for negative triples based on the Bloom filter.
  
  Pure PyTorch, a proper module which can be moved to GPU, and support batch-wise computation.
  
  .. seealso ::
      * https://github.com/hiway/python-bloom-filter/ - for calculation of sizes, and rough structure of code
      * https://github.com/skeeto/hash-prospector#two-round-functions - for parts of the hash function
docstr: Initialize the Bloom filter based filterer.
  
  :param mapped_triples:
      The ID-based triples.
  :param error_rate:
      The desired error rate.
docstr_tok: ["Initialize","the","Bloom","filter","based","filterer",".",":","param","mapped_triples",":","The","ID-based","triples",".",":","param","error_rate",":","The","desired","error","rate","."]
code: def __init__(
      self, mapped_triples: MappedTriples, error_rate: float = 0.001
  ):
      """
      Initialize the Bloom filter based filterer.
  
      :param mapped_triples:
          The ID-based triples.
      :param error_rate:
          The desired error rate.
      """
      super().__init__()
  
      # Allocate bit array
      self.ideal_num_elements = mapped_triples.shape[0]
      size = self.num_bits(
          num=self.ideal_num_elements, error_rate=error_rate
      )
      self.register_buffer(
          name="bit_array", tensor=torch.zeros(size, dtype=torch.bool)
      )
      self.register_buffer(
          name="mersenne",
          tensor=torch.as_tensor(
              data=[2**x - 1 for x in [17, 19, 31]],
              dtype=torch.long,
          ).unsqueeze(dim=0),
      )
  
      # calculate number of hashing rounds
      self.rounds = self.num_probes(
          num_elements=self.ideal_num_elements, num_bits=size
      )
  
      # index triples
      self.add(triples=mapped_triples)
  
      # Store some meta-data
      self.error_rate = error_rate
  
imports: import math
  from abc import abstractmethod
  from typing import Iterable
  import torch
  from class_resolver import ClassResolver
  from torch import nn
  from ..typing import MappedTriples
  from ..utils import triple_tensor_to_set
label_desc: Use image node_id 1 to create a new BloomFilterer object from inherited base classes: Filterer with example: obj = BloomFilterer(mapped_triples, error_rate)