code: def fit(self, X, y, sample_weight=None):
      """Fit the SVM model according to the given training data.
  
      Parameters
      ----------
      X : {array-like, sparse matrix}, shape (n_samples, n_features)
          Training vectors, where n_samples is the number of samples
          and n_features is the number of features.
          For kernel="precomputed", the expected shape of X is
          (n_samples, n_samples).
  
      y : array-like, shape (n_samples,)
          Target values (class labels in classification, real numbers in
          regression)
  
      sample_weight : array-like, shape (n_samples,)
          Per-sample weights. Rescale C per sample. Higher weights
          force the classifier to put more emphasis on these points.
  
      Returns
      -------
      self : object
  
      Notes
      ------
      If X and y are not C-ordered and contiguous arrays of np.float64 and
      X is not a scipy.sparse.csr_matrix, X and/or y may be copied.
  
      If X is a dense array, then the other methods will not support sparse
      matrices as input.
      """
      rnd = check_random_state(self.random_state)
  
      is_sparse = sp.isspmatrix(X)
      if is_sparse and self.kernel == "precomputed":
          raise TypeError(
              "Sparse precomputed kernels are not supported."
          )
      self._sparse = is_sparse and not callable(self.kernel)
  
      if hasattr(self, "decision_function_shape"):
          if self.decision_function_shape not in ("ovr", "ovo"):
              raise ValueError(
                  f"decision_function_shape must be either 'ovr' or 'ovo', "
                  f"got {self.decision_function_shape}."
              )
  
      if callable(self.kernel):
          check_consistent_length(X, y)
      else:
          X, y = self._validate_data(
              X,
              y,
              dtype=np.float64,
              order="C",
              accept_sparse="csr",
              accept_large_sparse=False,
          )
      y = self._validate_targets(y)
  
      sample_weight = np.asarray(
          [] if sample_weight is None else sample_weight,
          dtype=np.float64,
      )
      solver_type = _get_libsvm_impl().index(self._impl)
  
      # input validation
      n_samples = _num_samples(X)
      if solver_type != 2 and n_samples != y.shape[0]:
          raise ValueError(
              "X and y have incompatible shapes.\n"
              "X has %s samples, but y has %s."
              % (n_samples, y.shape[0])
          )
  
      if self.kernel == "precomputed" and n_samples != X.shape[1]:
          raise ValueError("X.shape[0] should be equal to X.shape[1]")
  
      if (
          sample_weight.shape[0] > 0
          and sample_weight.shape[0] != n_samples
      ):
          raise ValueError(
              "sample_weight and X have incompatible shapes: "
              "%r vs %r\n"
              "Note: Sparse matrices cannot be indexed w/"
              "boolean masks (use `indices=True` in CV)."
              % (sample_weight.shape, X.shape)
          )
  
      kernel = "precomputed" if callable(self.kernel) else self.kernel
      if kernel == "precomputed":
          self._gamma = 0.0
      else:
          self._gamma = _compute_gamma(self.gamma, kernel, X)
  
      fit = self._sparse_fit if self._sparse else self._dense_fit
      if self.verbose:  # pragma: no cover
          print("[LibSVM]", end="")
  
      # see comment on the other call to np.iinfo in this file
      seed = rnd.randint(np.iinfo("i").max)
  
      _patching_status = PatchingConditionsChain("sklearn.svm.SVC.fit")
      _dal_ready = _patching_status.and_conditions(
          [
              (
                  kernel in ["linear", "rbf"],
                  f"'{kernel}' kernel is not supported. "
                  "Only 'linear' and 'rbf' kernels are supported.",
              )
          ]
      )
      _patching_status.write_log()
      if _dal_ready:
          sample_weight = _daal4py_check_weight(
              self, X, y, sample_weight
          )
  
          self._daal_fit = True
          _daal4py_fit(
              self, X, y, sample_weight, kernel, is_sparse=is_sparse
          )
          self.fit_status_ = 0
  
          if self.probability:
              params = self.get_params()
              params["probability"] = False
              params["decision_function_shape"] = "ovr"
              clf_base = SVC(**params)
              try:
                  n_splits = 5
                  cv = StratifiedKFold(
                      n_splits=n_splits,
                      shuffle=True,
                      random_state=self.random_state,
                  )
                  if Version(sklearn_version) >= Version("0.24"):
                      self.clf_prob = CalibratedClassifierCV(
                          clf_base,
                          ensemble=False,
                          cv=cv,
                          method="sigmoid",
                          n_jobs=n_splits,
                      )
                  else:
                      self.clf_prob = CalibratedClassifierCV(
                          clf_base, cv=cv, method="sigmoid"
                      )
                  self.clf_prob.fit(X, y, sample_weight)
              except ValueError:
                  clf_base = clf_base.fit(X, y, sample_weight)
                  self.clf_prob = CalibratedClassifierCV(
                      clf_base, cv="prefit", method="sigmoid"
                  )
                  self.clf_prob.fit(X, y, sample_weight)
      else:
          self._daal_fit = False
          fit(
              X, y, sample_weight, solver_type, kernel, random_seed=seed
          )
  
      self.shape_fit_ = X.shape if hasattr(X, "shape") else (n_samples,)
  
      # In binary case, we need to flip the sign of coef, intercept and
      # decision function. Use self._intercept_ and self._dual_coef_ internally.
      if not getattr(self, "_daal_fit", False):
          self._internal_intercept_ = self.intercept_.copy()
          self._internal_dual_coef_ = self.dual_coef_.copy()
      else:
          self._internal_intercept_ = self.intercept_.copy()
          self._internal_dual_coef_ = self.dual_coef_.copy()
          if len(self.classes_) == 2:
              self._internal_dual_coef_ *= -1
              self._internal_intercept_ *= -1
  
      if (
          not getattr(self, "_daal_fit", False)
          and len(self.classes_) == 2
          and self._impl in ["c_svc", "nu_svc"]
      ):
          self.intercept_ *= -1
          self.dual_coef_ *= -1
  
      return self
  
imports: from __future__ import print_function
  import warnings
  import numpy
  import sklearn.svm._base
  import sklearn.svm._classes
  from scipy import sparse
  from sklearn.calibration import CalibratedClassifierCV
  from sklearn.exceptions import NotFittedError
  from sklearn.model_selection import StratifiedKFold
  from sklearn.utils import check_random_state
  from sklearn.utils.multiclass import _ovr_decision_function
  from sklearn.utils.validation import _check_sample_weight, _num_samples, check_consistent_length, check_is_fitted
  from sklearn import __version__
  import daal4py
  from .._utils import PatchingConditionsChain, getFPType, make2d, sklearn_check_version
label_desc: Use image node_id 17 for calling a global function with example usage: fit(X, y, sample_weight) and returns: self