class_docstr: Layer to calibrate the model outputs.
  
  The class implements the heuristics described in :cite:`calibration`,
  using Platt scaling :cite:`platt1999probabilistic`.
  
  See the docs of :meth:`~ampligraph.latent_features.models.ScoringBasedEmbeddingModel.calibrate()` for more details.
code: def __init__(
      self, pos_size=0, neg_size=0, positive_base_rate=None, **kwargs
  ):
      self.pos_size = pos_size
      self.neg_size = pos_size if neg_size == 0 else neg_size
  
      if positive_base_rate is not None:
          if positive_base_rate <= 0 or positive_base_rate >= 1:
              raise ValueError(
                  "Positive_base_rate must be a value between 0 and 1."
              )
      else:
          assert (
              pos_size > 0 and neg_size > 0
          ), "Positive size must be > 0."
  
          positive_base_rate = pos_size / (pos_size + neg_size)
  
      self.positive_base_rate = positive_base_rate
      self.w_init = tf.constant_initializer(kwargs.pop("calib_w", 0.0))
      self.b_init = tf.constant_initializer(
          kwargs.pop(
              "calib_b",
              float(
                  tf.math.log(
                      (self.neg_size + 1.0) / (self.pos_size + 1.0)
                  )
              ),
          )
      )
      super(CalibrationLayer, self).__init__(**kwargs)
  
imports: import tensorflow
label_desc: Use image node_id 2 to create a new CalibrationLayer object from inherited base classes: tf.keras.layers with example: obj = CalibrationLayer(pos_size, neg_size, positive_base_rate)