docstr: Calibrate predictions.
  
  The method implements the heuristics described in :cite:`calibration`,
  using Platt scaling :cite:`platt1999probabilistic`.
  
  The calibrated predictions can be obtained with :meth:`predict_proba`
  after calibration is done.
  
  Parameters
  ----------
  X_pos : ndarray, shape (n, 3)
      Numpy array of positive triples.
  X_neg : ndarray, shape (n, 3)
      Numpy array of negative triples.
      If `None`, the negative triples are generated via corruptions
      and the user must provide a positive base rate instead.
  positive_base_rate: float
      Base rate of positive statements.
      For example, if we assume there is a fifty-fifty chance of any
      query to be true, the base rate would be 50%. If ``X_neg`` is
      provided and this is `None`, the relative sizes of ``X_pos``
      and ``X_neg`` will be used to determine the base rate.
      For example, if we have 50 positive triples and 200 negative
      triples, the positive base rate will be assumed to be
      50/(50+200) = 1/5 = 0.2. This must be a value between 0 and 1.
  batches_count: int
      Number of batches to complete one epoch of the Platt
      scaling training. Only applies when ``X_neg`` is  `None`.
  epochs: int
      Number of epochs used to train the Platt scaling model.
      Only applies when ``X_neg`` is  `None`.
docstr_tok: ["Calibrate","predictions",".","The","method","implements","the","heuristics","described","in",":","cite",":","`","calibration","`",",","using","Platt","scaling",":","cite",":","`","platt1999probabilistic","`",".","The","calibrated","predictions","can","be","obtained","with",":","meth",":","`","predict_proba","`","after","calibration","is","done",".","Parameters","--","--","--","--","--","X_pos",":","ndarray",",","shape","(","n",",","3",")","Numpy","array","of","positive","triples",".","X_neg",":","ndarray",",","shape","(","n",",","3",")","Numpy","array","of","negative","triples",".","If","`","None","`",",","the","negative","triples","are","generated","via","corruptions","and","the","user","must","provide","a","positive","base","rate","instead",".","positive_base_rate",":","float","Base","rate","of","positive","statements",".","For","example",",","if","we","assume","there","is","a","fifty-fifty","chance","of","any","query","to","be","true",",","the","base","rate","would","be","50","%",".","If","``","X_neg","``","is","provided","and","this","is","`","None","`",",","the","relative","sizes","of","``","X_pos","``","and","``","X_neg","``","will","be","used","to","determine","the","base","rate",".","For","example",",","if","we","have","50","positive","triples","and","200","negative","triples",",","the","positive","base","rate","will","be","assumed","to","be","50\/","(","50+200",")","=","1\/5","=","0.2",".","This","must","be","a","value","between","0","and","1.","batches_count",":","int","Number","of","batches","to","complete","one","epoch","of","the","Platt","scaling","training",".","Only","applies","when","``","X_neg","``","is","`","None","`",".","epochs",":","int","Number","of","epochs","used","to","train","the","Platt","scaling","model",".","Only","applies","when","``","X_neg","``","is","`","None","`","."]
code: def calibrate(
      self,
      X_pos,
      X_neg=None,
      positive_base_rate=None,
      batches_count=100,
      epochs=50,
  ):
      """Calibrate predictions.
  
      The method implements the heuristics described in :cite:`calibration`,
      using Platt scaling :cite:`platt1999probabilistic`.
  
      The calibrated predictions can be obtained with :meth:`predict_proba`
      after calibration is done.
  
      Parameters
      ----------
      X_pos : ndarray, shape (n, 3)
          Numpy array of positive triples.
      X_neg : ndarray, shape (n, 3)
          Numpy array of negative triples.
          If `None`, the negative triples are generated via corruptions
          and the user must provide a positive base rate instead.
      positive_base_rate: float
          Base rate of positive statements.
          For example, if we assume there is a fifty-fifty chance of any
          query to be true, the base rate would be 50%. If ``X_neg`` is
          provided and this is `None`, the relative sizes of ``X_pos``
          and ``X_neg`` will be used to determine the base rate.
          For example, if we have 50 positive triples and 200 negative
          triples, the positive base rate will be assumed to be
          50/(50+200) = 1/5 = 0.2. This must be a value between 0 and 1.
      batches_count: int
          Number of batches to complete one epoch of the Platt
          scaling training. Only applies when ``X_neg`` is  `None`.
      epochs: int
          Number of epochs used to train the Platt scaling model.
          Only applies when ``X_neg`` is  `None`.
  
      """
      batch_size = int(np.ceil(X_pos.shape[0] / batches_count))
      return self.model.calibrate(
          X_pos, X_neg, positive_base_rate, batch_size, epochs
      )
  
imports: import numpy
  import tensorflow
  from ampligraph.latent_features.loss_functions import get
  from ampligraph.latent_features.models import ScoringBasedEmbeddingModel
  from ampligraph.latent_features.optimizers import get
  from ampligraph.latent_features.regularizers import get
label_desc: Use image node_id 11 for calling the ScoringModelBase obj's underlying member method code with example usage: obj.calibrate(X_pos, X_neg, positive_base_rate, batches_count, epochs) and returns: self