code: def test_fitted_knn_ensemble_predict(aggregator, normalizer):
      knn_detector = make_knn_detector(
          k=[8, 9, 10], aggregator=aggregator(), normalizer=normalizer()
      )
      x = np.array([[0, 10], [0, 0.1]])
  
      # test fitted detectors with inferred thresholds can score data using the predict method.
      y = knn_detector.predict(x)
      y = y["data"]
      assert y["threshold_inferred"]
      assert y["threshold"] is not None
      assert isinstance(y["threshold"], float)
      assert y["p_value"].all()
      assert (y["is_outlier"] == [True, False]).all()
  
      # test fitted detectors with inferred thresholds can score data using the score method.
      scores = knn_detector.score(x)
      assert np.all(y["instance_score"] == scores)
  
file_path: alibi-detect/alibi_detect/od/tests/test__knn/test__knn.py
imports: import pytest
  import numpy
  import torch
  from alibi_detect.od._knn import KNN
  from alibi_detect.od.pytorch.ensemble import AverageAggregator, TopKAggregator, MaxAggregator, MinAggregator, ShiftAndScaleNormalizer, PValNormalizer
  from alibi_detect.exceptions import NotFittedError, ThresholdNotInferredError
  from sklearn.datasets import make_moons
label_desc: Use image node_id 9 for calling a global function with example usage: test_fitted_knn_ensemble_predict(aggregator, normalizer) without return types