class_docstr: (Error-Correcting) Output-Code multiclass strategy.
  
  Output-code based strategies consist in representing each class with a
  binary code (an array of 0s and 1s). At fitting time, one binary
  classifier per bit in the code book is fitted.  At prediction time, the
  classifiers are used to project new points in the class space and the class
  closest to the points is chosen. The main advantage of these strategies is
  that the number of classifiers used can be controlled by the user, either
  for compressing the model (0 < `code_size` < 1) or for making the model more
  robust to errors (`code_size` > 1). See the documentation for more details.
  
  Read more in the :ref:`User Guide <ecoc>`.
  
  Parameters
  ----------
  estimator : estimator object
      An estimator object implementing :term:`fit` and one of
      :term:`decision_function` or :term:`predict_proba`.
  
  code_size : float, default=1.5
      Percentage of the number of classes to be used to create the code book.
      A number between 0 and 1 will require fewer classifiers than
      one-vs-the-rest. A number greater than 1 will require more classifiers
      than one-vs-the-rest.
  
  random_state : int, RandomState instance, default=None
      The generator used to initialize the codebook.
      Pass an int for reproducible output across multiple function calls.
      See :term:`Glossary <random_state>`.
  
  n_jobs : int, default=None
      The number of jobs to use for the computation: the multiclass problems
      are computed in parallel.
  
      ``None`` means 1 unless in a :obj:`joblib.parallel_backend` context.
      ``-1`` means using all processors. See :term:`Glossary <n_jobs>`
      for more details.
  
  Attributes
  ----------
  estimators_ : list of `int(n_classes * code_size)` estimators
      Estimators used for predictions.
  
  classes_ : ndarray of shape (n_classes,)
      Array containing labels.
  
  code_book_ : ndarray of shape (n_classes, code_size)
      Binary array containing the code of each class.
  
  n_features_in_ : int
      Number of features seen during :term:`fit`. Only defined if the
      underlying estimator exposes such an attribute when fit.
  
      .. versionadded:: 0.24
  
  feature_names_in_ : ndarray of shape (`n_features_in_`,)
      Names of features seen during :term:`fit`. Only defined if the
      underlying estimator exposes such an attribute when fit.
  
      .. versionadded:: 1.0
  
  See Also
  --------
  OneVsRestClassifier : One-vs-all multiclass strategy.
  OneVsOneClassifier : One-vs-one multiclass strategy.
  
  References
  ----------
  
  .. [1] "Solving multiclass learning problems via error-correcting output
     codes",
     Dietterich T., Bakiri G.,
     Journal of Artificial Intelligence Research 2,
     1995.
  
  .. [2] "The error coding method and PICTs",
     James G., Hastie T.,
     Journal of Computational and Graphical statistics 7,
     1998.
  
  .. [3] "The Elements of Statistical Learning",
     Hastie T., Tibshirani R., Friedman J., page 606 (second-edition)
     2008.
  
  Examples
  --------
  >>> from sklearn.multiclass import OutputCodeClassifier
  >>> from sklearn.ensemble import RandomForestClassifier
  >>> from sklearn.datasets import make_classification
  >>> X, y = make_classification(n_samples=100, n_features=4,
  ...                            n_informative=2, n_redundant=0,
  ...                            random_state=0, shuffle=False)
  >>> clf = OutputCodeClassifier(
  ...     estimator=RandomForestClassifier(random_state=0),
  ...     random_state=0).fit(X, y)
  >>> clf.predict([[0, 0, 0, 0]])
  array([1])
class_docstr_tok: ["(","Error-Correcting",")","Output-Code","multiclass","strategy",".","Output-code","based","strategies","consist","in","representing","each","class","with","a","binary","code","(","an","array","of","0s","and","1s",")",".","At","fitting","time",",","one","binary","classifier","per","bit","in","the","code","book","is","fitted",".","At","prediction","time",",","the","classifiers","are","used","to","project","new","points","in","the","class","space","and","the","class","closest","to","the","points","is","chosen",".","The","main","advantage","of","these","strategies","is","that","the","number","of","classifiers","used","can","be","controlled","by","the","user",",","either","for","compressing","the","model","(","0","<","`","code_size","`","<","1",")","or","for","making","the","model","more","robust","to","errors","(","`","code_size","`",">","1",")",".","See","the","documentation","for","more","details",".","Read","more","in","the",":","ref",":","`","User","Guide","<","ecoc",">","`",".","Parameters","--","--","--","--","--","estimator",":","estimator","object","An","estimator","object","implementing",":","term",":","`","fit","`","and","one","of",":","term",":","`","decision_function","`","or",":","term",":","`","predict_proba","`",".","code_size",":","float",",","default=1.5","Percentage","of","the","number","of","classes","to","be","used","to","create","the","code","book",".","A","number","between","0","and","1","will","require","fewer","classifiers","than","one-vs-the-rest",".","A","number","greater","than","1","will","require","more","classifiers","than","one-vs-the-rest",".","random_state",":","int",",","RandomState","instance",",","default=None","The","generator","used","to","initialize","the","codebook",".","Pass","an","int","for","reproducible","output","across","multiple","function","calls",".","See",":","term",":","`","Glossary","<","random_state",">","`",".","n_jobs",":","int",",","default=None","The","number","of","jobs","to","use","for","the","computation",":","the","multiclass","problems","are","computed","in","parallel",".","``","None","``","means","1","unless","in","a",":","obj",":","`","joblib.parallel_backend","`","context",".","``","-1","``","means","using","all","processors",".","See",":","term",":","`","Glossary","<","n_jobs",">","`","for","more","details",".","Attributes","--","--","--","--","--","estimators_",":","list","of","`","int","(","n_classes","*","code_size",")","`","estimators","Estimators","used","for","predictions",".","classes_",":","ndarray","of","shape","(","n_classes",",",")","Array","containing","labels",".","code_book_",":","ndarray","of","shape","(","n_classes",",","code_size",")","Binary","array","containing","the","code","of","each","class",".","n_features_in_",":","int","Number","of","features","seen","during",":","term",":","`","fit","`",".","Only","defined","if","the","underlying","estimator","exposes","such","an","attribute","when","fit",".","..","versionadded",":",":","0.24","feature_names_in_",":","ndarray","of","shape","(","`","n_features_in_","`",",",")","Names","of","features","seen","during",":","term",":","`","fit","`",".","Only","defined","if","the","underlying","estimator","exposes","such","an","attribute","when","fit",".","..","versionadded",":",":","1.0","See","Also","--","--","--","--","OneVsRestClassifier",":","One-vs-all","multiclass","strategy",".","OneVsOneClassifier",":","One-vs-one","multiclass","strategy",".","References","--","--","--","--","--","..","[","1","]","``","Solving","multiclass","learning","problems","via","error-correcting","output","codes","''",",","Dietterich","T.",",","Bakiri","G.",",","Journal","of","Artificial","Intelligence","Research","2",",","1995",".","..","[","2","]","``","The","error","coding","method","and","PICTs","''",",","James","G.",",","Hastie","T.",",","Journal","of","Computational","and","Graphical","statistics","7",",","1998",".","..","[","3","]","``","The","Elements","of","Statistical","Learning","''",",","Hastie","T.",",","Tibshirani","R.",",","Friedman","J.",",","page","606","(","second-edition",")","2008",".","Examples","--","--","--","--",">",">",">","from","sklearn.multiclass","import","OutputCodeClassifier",">",">",">","from","sklearn.ensemble","import","RandomForestClassifier",">",">",">","from","sklearn.datasets","import","make_classification",">",">",">","X",",","y","=","make_classification","(","n_samples=100",",","n_features=4",",","...","n_informative=2",",","n_redundant=0",",","...","random_state=0",",","shuffle=False",")",">",">",">","clf","=","OutputCodeClassifier","(","...","estimator=RandomForestClassifier","(","random_state=0",")",",","...","random_state=0",")",".fit","(","X",",","y",")",">",">",">","clf.predict","(","[","[","0",",","0",",","0",",","0","]","]",")","array","(","[","1","]",")"]
docstr: Fit underlying estimators.
  
  Parameters
  ----------
  X : {array-like, sparse matrix} of shape (n_samples, n_features)
      Data.
  
  y : array-like of shape (n_samples,)
      Multi-class targets.
  
  Returns
  -------
  self : object
      Returns a fitted instance of self.
code: def fit(self, X, y):
      """Fit underlying estimators.
  
      Parameters
      ----------
      X : {array-like, sparse matrix} of shape (n_samples, n_features)
          Data.
  
      y : array-like of shape (n_samples,)
          Multi-class targets.
  
      Returns
      -------
      self : object
          Returns a fitted instance of self.
      """
      y = self._validate_data(X="no_validation", y=y)
  
      random_state = check_random_state(self.random_state)
      check_classification_targets(y)
  
      self.classes_ = np.unique(y)
      n_classes = self.classes_.shape[0]
      if n_classes == 0:
          raise ValueError(
              "OutputCodeClassifier can not be fit when no class is present."
          )
      code_size_ = int(n_classes * self.code_size)
  
      # FIXME: there are more elaborate methods than generating the codebook
      # randomly.
      self.code_book_ = random_state.uniform(
          size=(n_classes, code_size_)
      )
      self.code_book_[self.code_book_ > 0.5] = 1.0
  
      if hasattr(self.estimator, "decision_function"):
          self.code_book_[self.code_book_ != 1] = -1.0
      else:
          self.code_book_[self.code_book_ != 1] = 0.0
  
      classes_index = {c: i for i, c in enumerate(self.classes_)}
  
      Y = np.array(
          [
              self.code_book_[classes_index[y[i]]]
              for i in range(_num_samples(y))
          ],
          dtype=int,
      )
  
      self.estimators_ = Parallel(n_jobs=self.n_jobs)(
          delayed(_fit_binary)(self.estimator, X, Y[:, i])
          for i in range(Y.shape[1])
      )
  
      if hasattr(self.estimators_[0], "n_features_in_"):
          self.n_features_in_ = self.estimators_[0].n_features_in_
      if hasattr(self.estimators_[0], "feature_names_in_"):
          self.feature_names_in_ = self.estimators_[0].feature_names_in_
  
      return self
  
imports: import array
  import itertools
  import warnings
  from numbers import Integral, Real
  import numpy
  import scipy.sparse
  from .base import BaseEstimator, ClassifierMixin, MetaEstimatorMixin, MultiOutputMixin, _fit_context, clone, is_classifier, is_regressor
  from .metrics.pairwise import pairwise_distances_argmin
  from .preprocessing import LabelBinarizer
  from .utils import check_random_state
  from .utils._param_validation import HasMethods, Interval
  from .utils._tags import _safe_tags
  from .utils.metaestimators import _safe_split, available_if
  from .utils.multiclass import _check_partial_fit_first_call, _ovr_decision_function, check_classification_targets
  from .utils.parallel import Parallel, delayed
  from .utils.validation import _num_samples, check_is_fitted
label_desc: Use image node_id 2 for calling the OutputCodeClassifier obj's underlying member method code with example usage: obj.fit(X, y) and returns: self