DetectAnomalies.py 525 B

12345678910111213141516171819
  1. # -*- coding: utf-8 -*-
  2. """
  3. @author: zsc
  4. @time: 2024/11/18
  5. @desc: 行为分析
  6. """
  7. # 异常检测模块
  8. class AnomalyDetector:
  9. def __init__(self, behavior_data):
  10. self.behavior_data = behavior_data
  11. def detect(self):
  12. # 根据新的数据结构调整异常检测逻辑
  13. anomalies = []
  14. for user, actions in self.behavior_data.items():
  15. if '结果-支用成功' in actions and actions['结果-支用成功'] > 5:
  16. anomalies.append(user)
  17. return anomalies