class_docstr: A class for applying Isotonic Calibration to the outputs of a binary or multi-class classifier.
  
  .. seealso::
  
     `Examples using calibration <https://stellargraph.readthedocs.io/en/stable/demos/calibration/index.html>`__.
  
     Related functionality: :func:`.expected_calibration_error`, :func:`.plot_reliability_diagram`, :class:`.TemperatureCalibration`.
class_docstr_tok: ["A","class","for","applying","Isotonic","Calibration","to","the","outputs","of","a","binary","or","multi-class","classifier",".","..","seealso",":",":","`","Examples","using","calibration","<","https",":","\/\/stellargraph.readthedocs.io\/en\/stable\/demos\/calibration\/index.html",">","`","__",".","Related","functionality",":",":","func",":","`",".expected_calibration_error","`",",",":","func",":","`",".plot_reliability_diagram","`",",",":","class",":","`",".TemperatureCalibration","`","."]
docstr: This method calibrates the given data assumed the output of a classification model.
  
  For multi-class classification, the probabilities for each class are first scaled using the corresponding
  isotonic regression model and then normalized to sum to 1.
  
  Args:
      x (numpy array): The values to calibrate. For binary classification problems it should have shape (N,) where
          N is the number of samples to calibrate. For multi-class classification problems, it should have shape
          (N, C) where C is the number of classes.
  
  Returns:
      numpy array: The calibrated probabilities. It has shape (N, C) where N is the number of samples
      and C is the number of classes.
docstr_tok: ["This","method","calibrates","the","given","data","assumed","the","output","of","a","classification","model",".","For","multi-class","classification",",","the","probabilities","for","each","class","are","first","scaled","using","the","corresponding","isotonic","regression","model","and","then","normalized","to","sum","to","1",".","Args",":","x","(","numpy","array",")",":","The","values","to","calibrate",".","For","binary","classification","problems","it","should","have","shape","(","N",",",")","where","N","is","the","number","of","samples","to","calibrate",".","For","multi-class","classification","problems",",","it","should","have","shape","(","N",",","C",")","where","C","is","the","number","of","classes",".","Returns",":","numpy","array",":","The","calibrated","probabilities",".","It","has","shape","(","N",",","C",")","where","N","is","the","number","of","samples","and","C","is","the","number","of","classes","."]
code: def predict(self, x):
      """
      This method calibrates the given data assumed the output of a classification model.
  
      For multi-class classification, the probabilities for each class are first scaled using the corresponding
      isotonic regression model and then normalized to sum to 1.
  
      Args:
          x (numpy array): The values to calibrate. For binary classification problems it should have shape (N,) where
              N is the number of samples to calibrate. For multi-class classification problems, it should have shape
              (N, C) where C is the number of classes.
  
      Returns:
          numpy array: The calibrated probabilities. It has shape (N, C) where N is the number of samples
          and C is the number of classes.
      """
      if not isinstance(x, np.ndarray):
          raise ValueError(
              "x should be numpy.ndarray but received {}".format(
                  type(x).__name__
              )
          )
  
      if self.n_classes > 1 and x.shape[1] != self.n_classes:
          raise ValueError(
              "Expecting input vector of dimensionality {} but received {}".format(
                  self.n_classes, len(x)
              )
          )
  
      if self.n_classes == 1:
          x = x.reshape(-1, 1)
  
      predictions = []
      for n in range(self.n_classes):
          predictions.append(self.regressors[n].transform(T=x[:, n]))
  
      predictions = np.transpose(np.array(predictions))
  
      if self.n_classes > 1:
          predictions = predictions / np.sum(
              predictions, axis=-1, keepdims=True
          )
  
      return predictions
  
imports: import numpy
  import matplotlib.pyplot
  import tensorflow
  from sklearn.isotonic import IsotonicRegression
  from sklearn.linear_model import LogisticRegression
label_desc: Use image node_id 3 for calling the IsotonicCalibration obj's underlying member method code with example usage: obj.predict(x) and returns: predictions