docstr: Params
  ------
  _sample_weight: array-like of shape (n_samples,), default=None
      Sample weights. If None, then samples are equally weighted.
      Splits that would create child nodes with net zero or negative weight
      are ignored while searching for a split in each node.
docstr_tok: ["Params","--","--","--","_sample_weight",":","array-like","of","shape","(","n_samples",",",")",",","default=None","Sample","weights",".","If","None",",","then","samples","are","equally","weighted",".","Splits","that","would","create","child","nodes","with","net","zero","or","negative","weight","are","ignored","while","searching","for","a","split","in","each","node","."]
code: def fit(self, X, y=None, feature_names=None, sample_weight=None):
      """
      Params
      ------
      _sample_weight: array-like of shape (n_samples,), default=None
          Sample weights. If None, then samples are equally weighted.
          Splits that would create child nodes with net zero or negative weight
          are ignored while searching for a split in each node.
      """
      X, y, feature_names = check_fit_arguments(
          self, X, y, feature_names
      )
      if isinstance(self, RegressorMixin):
          raise Warning("TAO Regression is not yet tested")
      X, y = check_X_y(X, y)
      y = y.astype(float)
      if feature_names is not None:
          self.feature_names_ = feature_names
      if self.model_type == "CART":
          if isinstance(self, ClassifierMixin):
              self.model = DecisionTreeClassifier(**self.model_args)
          elif isinstance(self, RegressorMixin):
              self.model = DecisionTreeRegressor(**self.model_args)
          self.model.fit(X, y, sample_weight=sample_weight)
          if self.verbose:
              print(export_text(self.model))
          # plot_tree(self.model)
          # plt.savefig('/Users/chandan/Desktop/tree.png', dpi=300)
          # plt.show()
  
      if self.randomize_tree:
          np.random.shuffle(
              self.model.tree_.feature
          )  # shuffle CART features
          # np.random.shuffle(self.model.tree_.threshold)
          for i in range(
              self.model.tree_.node_count
          ):  # split on feature medians
              self.model.tree_.threshold[i] = np.median(
                  X[:, self.model.tree_.feature[i]]
              )
      if self.verbose:
          print("starting score", self.model.score(X, y))
      for i in range(self.n_iters):
          num_updates = self._tao_iter_cart(
              X, y, self.model.tree_, sample_weight=sample_weight
          )
          if num_updates == 0:
              break
  
      return self
  
imports: import random
  from copy import deepcopy
  from queue import deque
  import numpy
  from mlxtend.classifier import LogisticRegression
  from sklearn import datasets
  from sklearn.base import BaseEstimator, RegressorMixin, ClassifierMixin
  from sklearn.linear_model import LinearRegression
  from sklearn.metrics import get_scorer
  from sklearn.model_selection import train_test_split
  from sklearn.tree import DecisionTreeClassifier, DecisionTreeRegressor, export_text
  from sklearn.utils import check_X_y
  from imodels.util.arguments import check_fit_arguments
label_desc: Use image node_id 3 for calling the TaoTree obj's underlying member method code with example usage: obj.fit(X, y, feature_names, sample_weight) and returns: self