code: def test_AnomalyDetector():
      df, cols = _generate_dataset()
      idx_anomaly = [8, 12, 25, 22, 76, 48]
      df.loc[idx_anomaly, cols] = 5
      ad = AnomalyDetector(
          label="label",
          n_folds=2,
          detector_list=[LOF(n_neighbors=5), LOF(n_neighbors=10)],
      )
      anomaly_scores = ad.fit_transform(df)
      assert sorted(
          anomaly_scores.sort_values(ascending=False).index[
              : len(idx_anomaly)
          ]
      ) == sorted(idx_anomaly)
      assert ad.predict(pd.DataFrame({"A": [0], "B": [1]}))[0] < 1
      assert ad.predict(pd.DataFrame({"A": [5], "B": [10]}))[0] > 1
  
file_path: autogluon/eda/tests/unittests/analysis/test_anomaly.py
imports: from unittest.mock import MagicMock
  import numpy
  import pandas
  import pytest
  from pandas.testing import assert_frame_equal
  from pyod.models.lof import LOF
  from autogluon.eda import AnalysisState
  from autogluon.eda.analysis import AnomalyDetector, AnomalyDetectorAnalysis
label_desc: Use image node_id 1 for calling a global function with example usage: test_AnomalyDetector() without return types