class_docstr: Random under-sampling integrated in the learning of AdaBoost.
  
  During learning, the problem of class balancing is alleviated by random
  under-sampling the sample at each iteration of the boosting algorithm.
  
  Read more in the :ref:`User Guide <boosting>`.
  
  .. versionadded:: 0.4
  
  Parameters
  ----------
  estimator : estimator object, default=None
      The base estimator from which the boosted ensemble is built.
      Support for sample weighting is required, as well as proper
      ``classes_`` and ``n_classes_`` attributes. If ``None``, then
      the base estimator is ``DecisionTreeClassifier(max_depth=1)``.
  
      .. versionadded:: 0.12
  
  n_estimators : int, default=50
      The maximum number of estimators at which boosting is terminated.
      In case of perfect fit, the learning procedure is stopped early.
  
  learning_rate : float, default=1.0
      Learning rate shrinks the contribution of each classifier by
      ``learning_rate``. There is a trade-off between ``learning_rate`` and
      ``n_estimators``.
  
  algorithm : {{'SAMME', 'SAMME.R'}}, default='SAMME.R'
      If 'SAMME.R' then use the SAMME.R real boosting algorithm.
      ``base_estimator`` must support calculation of class probabilities.
      If 'SAMME' then use the SAMME discrete boosting algorithm.
      The SAMME.R algorithm typically converges faster than SAMME,
      achieving a lower test error with fewer boosting iterations.
  
  {sampling_strategy}
  
  replacement : bool, default=False
      Whether or not to sample randomly with replacement or not.
  
  {random_state}
  
  base_estimator : estimator object, default=None
      The base estimator from which the boosted ensemble is built.
      Support for sample weighting is required, as well as proper
      ``classes_`` and ``n_classes_`` attributes. If ``None``, then
      the base estimator is ``DecisionTreeClassifier(max_depth=1)``.
  
      .. deprecated:: 0.10
         `base_estimator` is deprecated in version 0.10 and will be removed
         in 0.12. Use `estimator` instead.
  
  Attributes
  ----------
  estimator_ : estimator
      The base estimator from which the ensemble is grown.
  
      .. versionadded:: 0.10
  
  base_estimator_ : estimator
      The base estimator from which the ensemble is grown.
  
      .. deprecated:: 1.2
         `base_estimator_` is deprecated in `scikit-learn` 1.2 and will be
         removed in 1.4. Use `estimator_` instead. When the minimum version
         of `scikit-learn` supported by `imbalanced-learn` will reach 1.4,
         this attribute will be removed.
  
  estimators_ : list of classifiers
      The collection of fitted sub-estimators.
  
  base_sampler_ : :class:`~imblearn.under_sampling.RandomUnderSampler`
      The base sampler used to generate the subsequent samplers.
  
  samplers_ : list of :class:`~imblearn.under_sampling.RandomUnderSampler`
      The collection of fitted samplers.
  
  pipelines_ : list of Pipeline
      The collection of fitted pipelines (samplers + trees).
  
  classes_ : ndarray of shape (n_classes,)
      The classes labels.
  
  n_classes_ : int
      The number of classes.
  
  estimator_weights_ : ndarray of shape (n_estimator,)
      Weights for each estimator in the boosted ensemble.
  
  estimator_errors_ : ndarray of shape (n_estimator,)
      Classification error for each estimator in the boosted
      ensemble.
  
  feature_importances_ : ndarray of shape (n_features,)
      The feature importances if supported by the ``base_estimator``.
  
  n_features_in_ : int
      Number of features in the input dataset.
  
      .. versionadded:: 0.9
  
  feature_names_in_ : ndarray of shape (`n_features_in_`,)
      Names of features seen during `fit`. Defined only when `X` has feature
      names that are all strings.
  
      .. versionadded:: 0.9
  
  See Also
  --------
  BalancedBaggingClassifier : Bagging classifier for which each base
      estimator is trained on a balanced bootstrap.
  
  BalancedRandomForestClassifier : Random forest applying random-under
      sampling to balance the different bootstraps.
  
  EasyEnsembleClassifier : Ensemble of AdaBoost classifier trained on
      balanced bootstraps.
  
  References
  ----------
  .. [1] Seiffert, C., Khoshgoftaar, T. M., Van Hulse, J., & Napolitano, A.
     "RUSBoost: A hybrid approach to alleviating class imbalance." IEEE
     Transactions on Systems, Man, and Cybernetics-Part A: Systems and Humans
     40.1 (2010): 185-197.
  
  Examples
  --------
  >>> from imblearn.ensemble import RUSBoostClassifier
  >>> from sklearn.datasets import make_classification
  >>>
  >>> X, y = make_classification(n_samples=1000, n_classes=3,
  ...                            n_informative=4, weights=[0.2, 0.3, 0.5],
  ...                            random_state=0)
  >>> clf = RUSBoostClassifier(random_state=0)
  >>> clf.fit(X, y)
  RUSBoostClassifier(...)
  >>> clf.predict(X)
  array([...])
docstr: Implement a single boost using the SAMME discrete algorithm.
docstr_tok: ["Implement","a","single","boost","using","the","SAMME","discrete","algorithm","."]
code: def _boost_discrete(self, iboost, X, y, sample_weight, random_state):
      """Implement a single boost using the SAMME discrete algorithm."""
      estimator, sampler = self._make_sampler_estimator(
          random_state=random_state
      )
  
      X_res, y_res = sampler.fit_resample(X, y)
      sample_weight_res = _safe_indexing(
          sample_weight, sampler.sample_indices_
      )
      estimator.fit(X_res, y_res, sample_weight=sample_weight_res)
  
      y_predict = estimator.predict(X)
  
      if iboost == 0:
          self.classes_ = getattr(estimator, "classes_", None)
          self.n_classes_ = len(self.classes_)
  
      # Instances incorrectly classified
      incorrect = y_predict != y
  
      # Error fraction
      estimator_error = np.mean(
          np.average(incorrect, weights=sample_weight, axis=0)
      )
  
      # Stop if classification is perfect
      if estimator_error <= 0:
          return sample_weight, 1.0, 0.0
  
      n_classes = self.n_classes_
  
      # Stop if the error is at least as bad as random guessing
      if estimator_error >= 1.0 - (1.0 / n_classes):
          self.estimators_.pop(-1)
          self.samplers_.pop(-1)
          self.pipelines_.pop(-1)
          if len(self.estimators_) == 0:
              raise ValueError(
                  "BaseClassifier in AdaBoostClassifier "
                  "ensemble is worse than random, ensemble "
                  "can not be fit."
              )
          return None, None, None
  
      # Boost weight using multi-class AdaBoost SAMME alg
      estimator_weight = self.learning_rate * (
          np.log((1.0 - estimator_error) / estimator_error)
          + np.log(n_classes - 1.0)
      )
  
      # Only boost the weights if I will fit again
      if not iboost == self.n_estimators - 1:
          # Only boost positive weights
          sample_weight *= np.exp(
              estimator_weight * incorrect * (sample_weight > 0)
          )
  
      return sample_weight, estimator_weight, estimator_error
  
imports: import copy
  import inspect
  import numbers
  import warnings
  from copy import deepcopy
  import numpy
  import sklearn
  from sklearn.base import clone
  from sklearn.ensemble import AdaBoostClassifier
  from sklearn.ensemble._base import _set_random_states
  from sklearn.tree import DecisionTreeClassifier
  from sklearn.utils import _safe_indexing, parse_version
  from sklearn.utils.validation import has_fit_parameter
  from ..base import _ParamsValidationMixin
  from ..pipeline import make_pipeline
  from ..under_sampling import RandomUnderSampler
  from ..under_sampling.base import BaseUnderSampler
  from ..utils import Substitution, check_target_type
  from ..utils._docstring import _random_state_docstring
  from ..utils._param_validation import Interval, StrOptions
  from ..utils.fixes import _fit_context
  from ._common import _adaboost_classifier_parameter_constraints
label_desc: Use image node_id 6 for calling the RUSBoostClassifier obj's underlying member method code with example usage: obj._boost_discrete(iboost, X, y, sample_weight, random_state) and returns: sample_weight,  estimator_weight,  estimator_error, sample_weight,  int,  int, None,  None,  None