code: def fit(self, X, y, groups=None):
      if self.model is not None:
          thundergbm.model_free(byref(self.model))
          self.model = None
      sparse = sp.isspmatrix(X)
      if sparse is False:
          X = sp.csr_matrix(X)
      X, y = check_X_y(
          X, y, dtype=np.float64, order="C", accept_sparse="csr"
      )
  
      fit = self._sparse_fit
  
      fit(X, y, groups=groups)
      return self
  
imports: from sklearn.base import BaseEstimator
  from sklearn.base import RegressorMixin, ClassifierMixin
  from sklearn.metrics import mean_squared_error, accuracy_score
  import numpy
  import scipy.sparse
  import statistics
  from sklearn.utils import check_X_y
  from ctypes import *
  from os import path
  from sys import platform
label_desc: Use image node_id 4 for calling the TGBMModel obj's underlying member method code with example usage: obj.fit(X, y, groups) and returns: self