class_docstr: Inductive conformal classifier.
  
  Parameters
  ----------
  nc_function : BaseScorer
      Nonconformity scorer object used to calculate nonconformity of
      calibration examples and test patterns. Should implement ``fit(x, y)``
      and ``calc_nc(x, y)``.
  
  smoothing : boolean
      Decides whether to use stochastic smoothing of p-values.
  
  Attributes
  ----------
  cal_x : numpy array of shape [n_cal_examples, n_features]
      Inputs of calibration set.
  
  cal_y : numpy array of shape [n_cal_examples]
      Outputs of calibration set.
  
  nc_function : BaseScorer
      Nonconformity scorer object used to calculate nonconformity scores.
  
  classes : numpy array of shape [n_classes]
      List of class labels, with indices corresponding to output columns
       of IcpClassifier.predict()
  
  See also
  --------
  IcpRegressor
  
  References
  ----------
  .. [1] Papadopoulos, H., & Haralambous, H. (2011). Reliable prediction
      intervals with regression neural networks. Neural Networks, 24(8),
      842-851.
class_docstr_tok: ["Inductive","conformal","classifier",".","Parameters","--","--","--","--","--","nc_function",":","BaseScorer","Nonconformity","scorer","object","used","to","calculate","nonconformity","of","calibration","examples","and","test","patterns",".","Should","implement","``","fit","(","x",",","y",")","``","and","``","calc_nc","(","x",",","y",")","``",".","smoothing",":","boolean","Decides","whether","to","use","stochastic","smoothing","of","p-values",".","Attributes","--","--","--","--","--","cal_x",":","numpy","array","of","shape","[","n_cal_examples",",","n_features","]","Inputs","of","calibration","set",".","cal_y",":","numpy","array","of","shape","[","n_cal_examples","]","Outputs","of","calibration","set",".","nc_function",":","BaseScorer","Nonconformity","scorer","object","used","to","calculate","nonconformity","scores",".","classes",":","numpy","array","of","shape","[","n_classes","]","List","of","class","labels",",","with","indices","corresponding","to","output","columns","of","IcpClassifier.predict","(",")","See","also","--","--","--","--","IcpRegressor","References","--","--","--","--","--","..","[","1","]","Papadopoulos",",","H.",",","&","Haralambous",",","H.","(","2011",")",".","Reliable","prediction","intervals","with","regression","neural","networks",".","Neural","Networks",",","24","(","8",")",",","842-851","."]
docstr: Predict the output values for a set of input patterns.
  
  Parameters
  ----------
  x : numpy array of shape [n_samples, n_features]
      Inputs of patters for which to predict output values.
  
  significance : float or None
      Significance level (maximum allowed error rate) of predictions.
      Should be a float between 0 and 1. If ``None``, then the p-values
      are output rather than the predictions.
  
  Returns
  -------
  p : numpy array of shape [n_samples, n_classes]
      If significance is ``None``, then p contains the p-values for each
      sample-class pair; if significance is a float between 0 and 1, then
      p is a boolean array denoting which labels are included in the
      prediction sets.
docstr_tok: ["Predict","the","output","values","for","a","set","of","input","patterns",".","Parameters","--","--","--","--","--","x",":","numpy","array","of","shape","[","n_samples",",","n_features","]","Inputs","of","patters","for","which","to","predict","output","values",".","significance",":","float","or","None","Significance","level","(","maximum","allowed","error","rate",")","of","predictions",".","Should","be","a","float","between","0","and","1",".","If","``","None","``",",","then","the","p-values","are","output","rather","than","the","predictions",".","Returns","--","--","--","-","p",":","numpy","array","of","shape","[","n_samples",",","n_classes","]","If","significance","is","``","None","``",",","then","p","contains","the","p-values","for","each","sample-class","pair",";","if","significance","is","a","float","between","0","and","1",",","then","p","is","a","boolean","array","denoting","which","labels","are","included","in","the","prediction","sets","."]
code: def predict(
      self, x: np.array, significance: Optional[float] = None
  ) -> np.array:
      """Predict the output values for a set of input patterns.
  
      Parameters
      ----------
      x : numpy array of shape [n_samples, n_features]
          Inputs of patters for which to predict output values.
  
      significance : float or None
          Significance level (maximum allowed error rate) of predictions.
          Should be a float between 0 and 1. If ``None``, then the p-values
          are output rather than the predictions.
  
      Returns
      -------
      p : numpy array of shape [n_samples, n_classes]
          If significance is ``None``, then p contains the p-values for each
          sample-class pair; if significance is a float between 0 and 1, then
          p is a boolean array denoting which labels are included in the
          prediction sets.
      """
      # TODO: if x == self.last_x ...
      n_test_objects = x.shape[0]
      p = np.zeros((n_test_objects, self.classes.size))
  
      for i, c in enumerate(self.classes):
          test_class = np.zeros(x.shape[0], dtype=self.classes.dtype)
          test_class.fill(c)
  
          # TODO: maybe calculate p-values using cython or similar
          # TODO: interpolated p-values
  
          # TODO: nc_function.calc_nc should take X * {y1, y2, ... ,yn}
          test_nc_scores = self.nc_function.score(x, test_class)
          for j, nc in enumerate(test_nc_scores):
              cal_scores = self.cal_scores[
                  self.condition((x[j, :], c))
              ][::-1]
              n_cal = cal_scores.size
              n_eq = sum(np.where(cal_scores == nc, 1, 0))
              n_gt = sum(np.where(cal_scores > nc, 1, 0))
  
              if self.smoothing:
                  p[j, i] = (
                      n_gt + n_eq * np.random.uniform(0, 1, 1)
                  ) / (n_cal + 1)
              else:
                  p[j, i] = (n_gt + n_eq) / (n_cal + 1)
  
      if significance is not None:
          return p > significance
      else:
          return p
  
imports: from collections import defaultdict
  from functools import partial
  from typing import Optional, Union
  import numpy
  from sklearn.base import BaseEstimator
  from lightwood.analysis.nc.base import RegressorMixin, ClassifierMixin, TSMixin
  from types import FunctionType
label_desc: Use image node_id 4 for calling the IcpClassifier obj's underlying member method code with example usage: obj.predict(x, significance) and returns: unknown, p