code: def test_kernel_PCA_integration_ts():
      """Test the kernel PCA detector can be scripted."""
      pca_detector = PCA(n_components=10, kernel=GaussianRBF())
      X_ref, _ = make_moons(
          1001, shuffle=True, noise=0.05, random_state=None
      )
      X_ref, x_inlier = X_ref[0:1000], X_ref[1000][None]
      pca_detector.fit(X_ref)
      pca_detector.infer_threshold(X_ref, 0.1)
      x_outlier = np.array([[1, 1]])
      ts_PCA = torch.jit.script(pca_detector.backend)
      x = torch.tensor([x_inlier[0], x_outlier[0]], dtype=torch.float32)
      y = ts_PCA(x)
      assert torch.all(y == torch.tensor([False, True]))
  
file_path: alibi-detect/alibi_detect/od/tests/test__pca/test__pca.py
imports: import pytest
  import numpy
  import torch
  from alibi_detect.utils.pytorch.kernels import GaussianRBF
  from alibi_detect.od._pca import PCA
  from alibi_detect.exceptions import NotFittedError
  from sklearn.datasets import make_moons
label_desc: Use image node_id 8 for calling a global function with example usage: test_kernel_PCA_integration_ts() without return types