code: def test_unfitted_PCA_single_score(detector):
      """Test pca detector throws errors when not fitted."""
      pca = detector()
      x = np.array([[0, 10, 11], [0.1, 0, 11]])
      x_ref = np.random.randn(100, 3)
  
      # test infer_threshold raises exception when not fitted
      with pytest.raises(NotFittedError) as err:
          pca.infer_threshold(x_ref, 0.1)
      assert (
          str(err.value)
          == f"{pca.__class__.__name__} has not been fit!"
      )
  
      # test score raises exception when not fitted
      with pytest.raises(NotFittedError) as err:
          pca.score(x)
      assert (
          str(err.value)
          == f"{pca.__class__.__name__} has not been fit!"
      )
  
      # test predict raises exception when not fitted
      with pytest.raises(NotFittedError) as err:
          pca.predict(x)
      assert (
          str(err.value)
          == f"{pca.__class__.__name__} has not been fit!"
      )
  
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 2 for calling a global function with example usage: test_unfitted_PCA_single_score(detector) without return types