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: Train a calibration model using the provided data.
  
  Args:
      x_train (numpy array): The training data that should be the classifier's probabilistic outputs. It should
          have shape N × C where N is the number of training samples and C is the number of classes.
      y_train (numpy array): The training class labels. For binary problems y_train has shape (N,)
          when N is the number of samples. For multi-class classification, y_train has shape (N,C) where
          C is the number of classes and y_train is using one-hot encoding.
docstr_tok: ["Train","a","calibration","model","using","the","provided","data",".","Args",":","x_train","(","numpy","array",")",":","The","training","data","that","should","be","the","classifier","'s","probabilistic","outputs",".","It","should","have","shape","N","\u00d7","C","where","N","is","the","number","of","training","samples","and","C","is","the","number","of","classes",".","y_train","(","numpy","array",")",":","The","training","class","labels",".","For","binary","problems","y_train","has","shape","(","N",",",")","when","N","is","the","number","of","samples",".","For","multi-class","classification",",","y_train","has","shape","(","N",",","C",")","where","C","is","the","number","of","classes","and","y_train","is","using","one-hot","encoding","."]
code: def fit(self, x_train, y_train):
      """
      Train a calibration model using the provided data.
  
      Args:
          x_train (numpy array): The training data that should be the classifier's probabilistic outputs. It should
              have shape N × C where N is the number of training samples and C is the number of classes.
          y_train (numpy array): The training class labels. For binary problems y_train has shape (N,)
              when N is the number of samples. For multi-class classification, y_train has shape (N,C) where
              C is the number of classes and y_train is using one-hot encoding.
  
      """
      if not isinstance(x_train, np.ndarray) or not isinstance(
          y_train, np.ndarray
      ):
          raise ValueError(
              "x_train and y_train should be type numpy.ndarray but received {} and {}".format(
                  type(x_train).__name__, type(y_train).__name__
              )
          )
  
      if len(x_train.shape) == 1:
          self.n_classes = 1
      else:
          self.n_classes = x_train.shape[1]
  
      if self.n_classes == 1:
          self.regressors.append(
              IsotonicRegression(out_of_bounds="clip")
          )
          if len(x_train.shape) > 1:
              x_train = x_train.reshape(-1)
          self.regressors[-1].fit(
              X=x_train.astype(np.double), y=y_train
          )
      else:
          for n in range(self.n_classes):
              self.regressors.append(
                  IsotonicRegression(out_of_bounds="clip")
              )
              self.regressors[-1].fit(
                  X=x_train[:, n].astype(np.double), y=y_train[:, n]
              )
  
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 2 for calling the IsotonicCalibration obj's underlying member method code with example usage: obj.fit(x_train, y_train) without return types