code: def _sparse_fit(self, X, y, solver_type, kernel):
      X.data = np.asarray(X.data, dtype=np.float32, order="C")
      X.sort_indices()
      kernel_type = kernel
      data = X.data.ctypes.data_as(POINTER(c_float))
      indices = X.indices.ctypes.data_as(POINTER(c_int32))
      indptr = X.indptr.ctypes.data_as(POINTER(c_int32))
      y = np.asarray(y, dtype=np.float32, order="C")
      label = y.ctypes.data_as(POINTER(c_float))
  
      if self.class_weight is None:
          weight_size = 0
          self.class_weight = dict()
          weight_label = (c_int * weight_size)()
          weight_label[:] = list(self.class_weight.keys())
          weight = (c_float * weight_size)()
          weight[:] = list(self.class_weight.values())
      elif self.class_weight == "balanced":
          y_unique = np.unique(y)
          y_count = np.bincount(y.astype(int))
          weight_label_list = []
          weight_list = []
          for n in range(0, len(y_count)):
              if y_count[n] != 0:
                  weight_label_list.append(n)
                  weight_list.append(
                      X.shape[0] / (len(y_unique) * y_count[n])
                  )
          weight_size = len(weight_list)
          weight_label = (c_int * weight_size)()
          weight_label[:] = weight_label_list
          weight = (c_float * weight_size)()
          weight[:] = weight_list
      else:
          weight_size = len(self.class_weight)
          weight_label = (c_int * weight_size)()
          weight_label[:] = list(self.class_weight.keys())
          weight = (c_float * weight_size)()
          weight[:] = list(self.class_weight.values())
  
      n_features = (c_int * 1)()
      n_classes = (c_int * 1)()
      self._train_succeed = (c_int * 1)()
      thundersvm.sparse_model_scikit(
          X.shape[0],
          data,
          indptr,
          indices,
          label,
          solver_type,
          kernel_type,
          self.degree,
          c_float(self._gamma),
          c_float(self.coef0),
          c_float(self.C),
          c_float(self.nu),
          c_float(self.epsilon),
          c_float(self.tol),
          self.probability,
          weight_size,
          weight_label,
          weight,
          self.verbose,
          self.max_iter,
          self.n_jobs,
          self.max_mem_size,
          self.gpu_id,
          n_features,
          n_classes,
          self._train_succeed,
          c_void_p(self.model),
      )
      self.n_features = n_features[0]
      self.n_classes = n_classes[0]
  
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 5 for calling the SvmModel obj's underlying member method code with example usage: obj._sparse_fit(X, y, solver_type, kernel) without return types