code: def _daal4py_fit(self, X, y_inp, sample_weight, kernel):
      if self.C <= 0:
          raise ValueError("C <= 0")
      num_classes = len(self.classes_)
  
      ww = _daal4py_check_weight(self, X, y_inp, sample_weight)
  
      y = make2d(y_inp)
      if num_classes == 2:
          # Intel(R) oneAPI Data Analytics Library requires binary classes to
          # be 1 and -1. sklearn normalizes the classes to 0 and 1, so we
          # temporarily replace the 0s with -1s.
          y = y.copy()
          y[y == 0] = -1
  
      X_fptype = getFPType(X)
  
      kf = _daal4py_kf(kernel, X_fptype, gamma=self._gamma)
      algo = _daal4py_svm(
          fptype=X_fptype,
          C=float(self.C),
          accuracyThreshold=float(self.tol),
          tau=1e-12,
          maxIterations=int(
              self.max_iter if self.max_iter > 0 else 2**30
          ),
          cacheSize=int(self.cache_size * 1024 * 1024),
          doShrinking=bool(self.shrinking),
          kernel=kf,
          nClasses=num_classes,
      )
  
      res = algo.compute(data=X, labels=y, weights=ww)
      model = res.model
      self.daal_model_ = model
  
      if num_classes == 2:
          # binary
          two_class_sv_ind_ = model.SupportIndices
          two_class_sv_ind_ = two_class_sv_ind_.ravel()
  
          # support indexes need permutation to arrange them into the same layout
          # as that of Scikit-Learn
          tmp = np.empty(
              two_class_sv_ind_.shape,
              dtype=np.dtype(
                  [("label", y.dtype), ("ind", two_class_sv_ind_.dtype)]
              ),
          )
          tmp["label"][:] = y[two_class_sv_ind_].ravel()
          tmp["ind"][:] = two_class_sv_ind_
          perm = np.argsort(tmp, order=["label", "ind"])
          del tmp
  
          self.support_ = two_class_sv_ind_[perm]
          self.support_vectors_ = X[self.support_]
  
          self.dual_coef_ = model.ClassificationCoefficients.T
          self.dual_coef_ = self.dual_coef_[:, perm]
          self.intercept_ = np.array([model.Bias])
  
      else:
          # multi-class
          intercepts = []
          coefs = []
          sv_ind_by_clf = []
          label_indexes = []
  
          model_id = 0
          for i1 in range(num_classes):
              label_indexes.append(np.where(y == i1)[0])
              for i2 in range(i1):
                  svm_model = model.TwoClassClassifierModel(model_id)
  
                  # Indices correspond to input features with label i1 followed
                  # by input features with label i2
                  two_class_sv_ind_ = svm_model.SupportIndices
                  # Map these indexes to indexes of the training data
                  sv_ind = np.take(
                      np.hstack((label_indexes[i1], label_indexes[i2])),
                      two_class_sv_ind_.ravel(),
                  )
                  sv_ind_by_clf.append(sv_ind)
  
                  # svs_ = getArrayFromNumericTable(svm_model.getSupportVectors())
                  # assert np.array_equal(svs_, X[sv_ind])
  
                  intercepts.append(-svm_model.Bias)
                  coefs.append(-svm_model.ClassificationCoefficients)
                  model_id += 1
  
          # permute solutions to lexicographic ordering
          to_lex_perm = map_to_lexicographic(num_classes)
          sv_ind_by_clf = permute_list(sv_ind_by_clf, to_lex_perm)
          sv_coef_by_clf = permute_list(coefs, to_lex_perm)
          intercepts = permute_list(intercepts, to_lex_perm)
  
          self.dual_coef_, self.support_ = extract_dual_coef(
              num_classes,  # number of classes
              sv_ind_by_clf,  # support vector indexes by two-class classifiers
              sv_coef_by_clf,  # classification coefficients by two-class classifiers
              y.squeeze().astype(np.intp, copy=False),  # integer labels
          )
          self.support_vectors_ = X[self.support_]
          self.intercept_ = np.array(intercepts)
  
      indices = y.take(self.support_, axis=0)
      if num_classes == 2:
          self._n_support = np.array(
              [np.sum(indices == -1), np.sum(indices == 1)],
              dtype=np.int32,
          )
      else:
          self._n_support = np.array(
              [
                  np.sum(indices == i)
                  for i, c in enumerate(self.classes_)
              ],
              dtype=np.int32,
          )
  
      try:
          self.probA_ = np.empty(0)
          self.probB_ = np.empty(0)
      except AttributeError:
          # in master probA_ and probB_ are deprecated read-only attributes
          self._probA = np.empty(0)
          self._probB = np.empty(0)
  
imports: from __future__ import print_function
  import warnings
  import numpy
  import sklearn.svm._base
  import sklearn.svm._classes
  from scipy import sparse
  from sklearn.utils import check_random_state, check_X_y
  from sklearn.utils.validation import _check_sample_weight, check_is_fitted
  import daal4py
  from .._utils import PatchingConditionsChain, getFPType, make2d, sklearn_check_version
label_desc: Use image node_id 14 for calling a global function with example usage: _daal4py_fit(X, y_inp, sample_weight, kernel) without return types