code: def fit(self, X, y):
      if self.model is not None:
          thundersvm.model_free(c_void_p(self.model))
          self.model = None
      sparse = sp.isspmatrix(X)
      self._sparse = sparse and not callable(self.kernel)
      X, y = check_X_y(
          X, y, dtype=np.float64, order="C", accept_sparse="csr"
      )
      y = column_or_1d(y, warn=True).astype(np.float64)
  
      solver_type = SVM_TYPE.index(self._impl)
  
      if self.gamma == "auto":
          self._gamma = 1.0 / X.shape[1]
      else:
          self._gamma = self.gamma
      if self.kernel not in KERNEL_TYPE:
          print(
              "The kernel parameter not recognized, please refer to the document."
          )
          exit()
      else:
          kernel = KERNEL_TYPE.index(self.kernel)
  
      fit = self._sparse_fit if self._sparse else self._dense_fit
      thundersvm.model_new.restype = c_void_p
      self.model = thundersvm.model_new(solver_type)
      if self.max_mem_size != -1:
          thundersvm.set_memory_size(
              c_void_p(self.model), self.max_mem_size
          )
      fit(X, y, solver_type, kernel)
      if self._train_succeed[0] == -1:
          print("Training failed!")
          return
      self.n_sv = thundersvm.n_sv(c_void_p(self.model))
      csr_row = (c_int * (self.n_sv + 1))()
      csr_col = (c_int * (self.n_sv * self.n_features))()
      csr_data = (c_float * (self.n_sv * self.n_features))()
      data_size = (c_int * 1)()
      sv_indices = (c_int * self.n_sv)()
      thundersvm.get_sv(
          csr_row,
          csr_col,
          csr_data,
          data_size,
          sv_indices,
          c_void_p(self.model),
      )
      self.row = np.frombuffer(csr_row, dtype=np.int32)
      self.col = np.frombuffer(csr_col, dtype=np.int32)[: data_size[0]]
      self.data = np.frombuffer(csr_data, dtype=np.float32)[
          : data_size[0]
      ]
  
      self.support_vectors_ = sp.csr_matrix(
          (self.data, self.col, self.row)
      )
      if not self._sparse:
          self.support_vectors_ = self.support_vectors_.toarray(
              order="C"
          )
      self.support_ = np.frombuffer(sv_indices, dtype=np.int32).astype(
          int
      )
  
      dual_coef = (c_float * ((self.n_classes - 1) * self.n_sv))()
      thundersvm.get_coef(
          dual_coef, self.n_classes, self.n_sv, c_void_p(self.model)
      )
  
      self.dual_coef_ = (
          np.frombuffer(dual_coef, dtype=np.float32)
          .astype(float)
          .reshape((self.n_classes - 1, self.n_sv))
      )
  
      rho_size = int(self.n_classes * (self.n_classes - 1) / 2)
      self.n_binary_model = rho_size
      rho = (c_float * rho_size)()
      thundersvm.get_rho(rho, rho_size, c_void_p(self.model))
      self.intercept_ = np.frombuffer(rho, dtype=np.float32).astype(
          float
      )
  
      if self.kernel == "linear":
          coef = (c_float * (self.n_binary_model * self.n_features))()
          thundersvm.get_linear_coef(
              coef,
              self.n_binary_model,
              self.n_features,
              c_void_p(self.model),
          )
          self.coef_ = (
              np.frombuffer(coef, dtype=np.float32)
              .astype(float)
              .reshape((self.n_binary_model, self.n_features))
          )
  
      n_support_ = (c_int * self.n_classes)()
      thundersvm.get_support_classes(
          n_support_, self.n_classes, c_void_p(self.model)
      )
  
      self.n_support_ = np.frombuffer(
          n_support_, dtype=np.int32
      ).astype(int)
      self.shape_fit_ = X.shape
  
      return self
  
imports: from sklearn.base import BaseEstimator
  from sklearn.base import RegressorMixin, ClassifierMixin
  import numpy
  import scipy.sparse
  from sklearn.utils import check_X_y, column_or_1d, check_array
  from sklearn.utils.validation import _num_samples
  from ctypes import *
  from os import path, curdir
  from sys import platform
label_desc: Use image node_id 3 for calling the SvmModel obj's underlying member method code with example usage: obj.fit(X, y) and returns: self