docstr: Set n_iter=2 for the same reason as for SGD
docstr_tok: ["Set","n_iter=2","for","the","same","reason","as","for","SGD"]
code: def iterative_fit(self, X, y, n_iter=2, refit=False):
      """Set n_iter=2 for the same reason as for SGD"""
      import sklearn.ensemble
      from sklearn.experimental import (
          enable_hist_gradient_boosting,
      )  # noqa
  
      if refit:
          self.estimator = None
  
      if self.estimator is None:
          self.fully_fit_ = False
          self.learning_rate = float(self.learning_rate)
          self.max_iter = int(self.max_iter)
          self.min_samples_leaf = int(self.min_samples_leaf)
          if check_none(self.max_depth):
              self.max_depth = None
          else:
              self.max_depth = int(self.max_depth)
          if check_none(self.max_leaf_nodes):
              self.max_leaf_nodes = None
          else:
              self.max_leaf_nodes = int(self.max_leaf_nodes)
          self.max_bins = int(self.max_bins)
          self.l2_regularization = float(self.l2_regularization)
          self.tol = float(self.tol)
          if check_none(self.scoring):
              self.scoring = None
          if self.early_stop == "off":
              self.n_iter_no_change = 0
              self.validation_fraction_ = None
          elif self.early_stop == "train":
              self.n_iter_no_change = int(self.n_iter_no_change)
              self.validation_fraction_ = None
          elif self.early_stop == "valid":
              self.n_iter_no_change = int(self.n_iter_no_change)
              self.validation_fraction_ = float(
                  self.validation_fraction
              )
          else:
              raise ValueError(
                  "early_stop should be either off, train or valid"
              )
          self.verbose = int(self.verbose)
          n_iter = int(np.ceil(n_iter))
  
          self.estimator = (
              sklearn.ensemble.HistGradientBoostingRegressor(
                  loss=self.loss,
                  learning_rate=self.learning_rate,
                  max_iter=n_iter,
                  min_samples_leaf=self.min_samples_leaf,
                  max_depth=self.max_depth,
                  max_leaf_nodes=self.max_leaf_nodes,
                  max_bins=self.max_bins,
                  l2_regularization=self.l2_regularization,
                  tol=self.tol,
                  scoring=self.scoring,
                  n_iter_no_change=self.n_iter_no_change,
                  validation_fraction=self.validation_fraction_,
                  verbose=self.verbose,
                  warm_start=True,
                  random_state=self.random_state,
              )
          )
      else:
          self.estimator.max_iter += n_iter
          self.estimator.max_iter = min(
              self.estimator.max_iter, self.max_iter
          )
  
      if y.ndim == 2 and y.shape[1] == 1:
          y = y.flatten()
  
      self.estimator.fit(X, y)
  
      if (
          self.estimator.max_iter >= self.max_iter
          or self.estimator.max_iter > self.estimator.n_iter_
      ):
          self.fully_fit_ = True
  
      return self
  
file_path: auto-sklearn/autosklearn/pipeline/components/regression/gradient_boosting.py
imports: from typing import Optional
  import numpy
  from ConfigSpace.conditions import EqualsCondition, InCondition
  from ConfigSpace.configuration_space import ConfigurationSpace
  from ConfigSpace.hyperparameters import CategoricalHyperparameter, Constant, UniformFloatHyperparameter, UniformIntegerHyperparameter, UnParametrizedHyperparameter
  from autosklearn.askl_typing import FEAT_TYPE_TYPE
  from autosklearn.pipeline.components.base import AutoSklearnRegressionAlgorithm, IterativeComponent
  from autosklearn.pipeline.constants import DENSE, PREDICTIONS, UNSIGNED_DATA
  from autosklearn.util.common import check_none
label_desc: Use image node_id 4 for calling the GradientBoosting obj's underlying member method code with example usage: obj.iterative_fit(X, y, n_iter, refit) and returns: self