code: def fit(self, X, y, sample_weight=None, *args, **kwargs):
      # remove feature_names if it exists (note: only works as keyword-arg)
      # None returned if not passed
      feature_names = kwargs.pop("feature_names", None)
      X, y, feature_names = check_fit_arguments(
          self, X, y, feature_names
      )
      if feature_names is not None:
          self.feature_names = feature_names
      self.estimator_ = self.estimator_.fit(
          X, y, *args, sample_weight=sample_weight, **kwargs
      )
      self._shrink()
  
      # compute complexity
      if hasattr(self.estimator_, "tree_"):
          self.complexity_ = compute_tree_complexity(
              self.estimator_.tree_
          )
      elif hasattr(self.estimator_, "estimators_"):
          self.complexity_ = 0
          for i in range(len(self.estimator_.estimators_)):
              t = deepcopy(self.estimator_.estimators_[i])
              if isinstance(t, np.ndarray):
                  assert (
                      t.size == 1
                  ), "multiple trees stored under tree_?"
                  t = t[0]
              self.complexity_ += compute_tree_complexity(t.tree_)
      return self
  
imports: import time
  from copy import deepcopy
  from typing import List
  import numpy
  from sklearn import datasets
  from sklearn.base import BaseEstimator, RegressorMixin, ClassifierMixin
  from sklearn.metrics import r2_score, mean_squared_error, log_loss
  from sklearn.model_selection import cross_val_score, KFold
  from sklearn.model_selection import train_test_split
  from sklearn.tree import DecisionTreeRegressor, DecisionTreeClassifier, export_text
  from sklearn.ensemble import GradientBoostingClassifier, GradientBoostingRegressor, RandomForestRegressor
  from imodels.util import checks
  from imodels.util.arguments import check_fit_arguments
  from imodels.util.tree import compute_tree_complexity
label_desc: Use image node_id 3 for calling the HSTree obj's underlying member method code with example usage: obj.fit(X, y, sample_weight) and returns: self