code: def test_svm_fit(optimization):
      """Test SVM detector fit method.
  
      Tests pytorch detector checks for convergence and stops early if it does.
      """
      kernel = GaussianRBF(torch.tensor(1.0))
      svm = SVM(
          n_components=10,
          kernel=kernel,
          nu=0.01,
          optimization=optimization,
      )
      mean = [8, 8]
      cov = [[2.0, 0.0], [0.0, 1.0]]
      x_ref = torch.tensor(
          np.random.multivariate_normal(mean, cov, 1000)
      )
      fit_results = svm.fit(x_ref, tol=0.01)
      assert fit_results["converged"]
      assert fit_results["n_iter"] < 100
      assert fit_results.get("lower_bound", 0) < 1
      # 'sgd' optimization does not return lower bound
      if optimization == "bgd":
          assert isinstance(fit_results["lower_bound"], float)
  
file_path: alibi-detect/alibi_detect/od/tests/test__svm/test__svm.py
imports: import pytest
  import numpy
  import torch
  from alibi_detect.od._svm import SVM
  from alibi_detect.exceptions import NotFittedError
  from alibi_detect.utils.pytorch import GaussianRBF
  from sklearn.datasets import make_moons
label_desc: Use image node_id 9 for calling a global function with example usage: test_svm_fit(optimization) without return types