class_docstr: Base class for forest of trees-based classifiers.
  
  Warning: This class should not be used directly. Use derived classes
  instead.
class_docstr_tok: ["Base","class","for","forest","of","trees-based","classifiers",".","Warning",":","This","class","should","not","be","used","directly",".","Use","derived","classes","instead","."]
code: def _validate_y_class_weight(self, y):
      check_classification_targets(y)
  
      y = np.copy(y)
      expanded_class_weight = None
  
      if self.class_weight is not None:
          y_original = np.copy(y)
  
      self.classes_ = []
      self.n_classes_ = []
  
      y_store_unique_indices = np.zeros(y.shape, dtype=np.int)
      for k in range(self.n_outputs_):
          classes_k, y_store_unique_indices[:, k] = np.unique(
              y[:, k], return_inverse=True
          )
          self.classes_.append(classes_k)
          self.n_classes_.append(classes_k.shape[0])
      y = y_store_unique_indices
  
      if self.class_weight is not None:
          valid_presets = (
              "auto",
              "balanced",
              "subsample",
              "balanced_subsample",
          )
          if isinstance(self.class_weight, six.string_types):
              if self.class_weight not in valid_presets:
                  raise ValueError(
                      "Valid presets for class_weight include "
                      '"balanced" and "balanced_subsample". Given "%s".'
                      % self.class_weight
                  )
              if self.class_weight == "subsample":
                  warn(
                      "class_weight='subsample' is deprecated in 0.17 and"
                      "will be removed in 0.19. It was replaced by "
                      "class_weight='balanced_subsample' using the balanced"
                      "strategy.",
                      DeprecationWarning,
                  )
              if self.warm_start:
                  warn(
                      'class_weight presets "balanced" or "balanced_subsample" are '
                      "not recommended for warm_start if the fitted data "
                      "differs from the full dataset. In order to use "
                      '"balanced" weights, use compute_class_weight("balanced", '
                      "classes, y). In place of y you can use a large "
                      "enough sample of the full training set target to "
                      "properly estimate the class frequency "
                      "distributions. Pass the resulting weights as the "
                      "class_weight parameter."
                  )
  
          if (
              self.class_weight
              not in ["subsample", "balanced_subsample"]
              or not self.bootstrap
          ):
              if self.class_weight == "subsample":
                  class_weight = "auto"
              elif self.class_weight == "balanced_subsample":
                  class_weight = "balanced"
              else:
                  class_weight = self.class_weight
              with warnings.catch_warnings():
                  if class_weight == "auto":
                      warnings.simplefilter(
                          "ignore", DeprecationWarning
                      )
                  expanded_class_weight = compute_sample_weight(
                      class_weight, y_original
                  )
  
      return y, expanded_class_weight
  
imports: from __future__ import division
  import warnings
  from warnings import warn
  from abc import ABCMeta, abstractmethod
  import numpy
  from scipy.sparse import issparse
  from scipy.sparse import hstack
  from ..base import ClassifierMixin, RegressorMixin
  from ..externals.joblib import Parallel, delayed
  from ..externals import six
  from ..feature_selection.from_model import _LearntSelectorMixin
  from ..metrics import r2_score
  from ..preprocessing import OneHotEncoder
  from ..tree import DecisionTreeClassifier, DecisionTreeRegressor, ExtraTreeClassifier, ExtraTreeRegressor
  from ..tree._tree import DTYPE, DOUBLE
  from ..utils import check_random_state, check_array, compute_sample_weight
  from ..exceptions import DataConversionWarning, NotFittedError
  from .base import BaseEnsemble, _partition_estimators
  from ..utils.fixes import bincount, parallel_helper
  from ..utils.multiclass import check_classification_targets
label_desc: Use image node_id 3 for calling the ForestClassifier obj's underlying member method code with example usage: obj._validate_y_class_weight(y) and returns: y,  expanded_class_weight