什么是异常检测器 API?What is the Anomaly Detector API?


现在,将对此服务的所有 HTTP 请求强制执行 TLS 1.2。TLS 1.2 is now enforced for all HTTP requests to this service.

使用异常检测器 API,无需了解机器学习方面的知识,就能监视和检测时序数据中的异常。The Anomaly Detector API enables you to monitor and detect abnormalities in your time series data without having to know machine learning. 异常检测器 API 算法通过自动标识最佳适配模型并将其应用到数据来进行自适应,并且不限行业、场景或数据量。The Anomaly Detector API's algorithms adapt by automatically identifying and applying the best-fitting models to your data, regardless of industry, scenario, or data volume. 使用时序数据,此 API 可以确定异常检测的边界、预期的值,以及哪些数据点异常。Using your time series data, the API determines boundaries for anomaly detection, expected values, and which data points are anomalies.


使用异常检测器不需要以前在机器学习方面有任何经验,你可以使用 RESTful API 轻松地将服务集成到应用程序和进程中。Using the Anomaly Detector doesn't require any prior experience in machine learning, and the RESTful API enables you to easily integrate the service into your applications and processes.

本文档包含以下类型的文章:This documentation contains the following types of articles:

  • 快速入门是分步说明,可按照其调用服务,并在短时间内获得结果。The quickstarts are step-by-step instructions that let you make calls to the service and get results in a short period of time.
  • 操作指南包含以更具体的方式或自定义方式使用服务的说明。The how-to guides contain instructions for using the service in more specific or customized ways.
  • 概念性文章对服务的功能和特性进行了深入说明。The conceptual articles provide in-depth explanations of the service's functionality and features.
  • 教程是较长的指南,向你演示了如何在更广泛的业务解决方案中使用此服务作为组件。The tutorials are longer guides that show you how to use this service as a component in broader business solutions.


可以使用异常检测器自动检测时序数据中的异常以及实时出现的异常。With the Anomaly Detector, you can automatically detect anomalies throughout your time series data, or as they occur in real-time.

功能Feature 说明Description
实时检测异常。Anomaly detection in real-time. 检测流式传输数据中的异常,方法是:使用以前见过的数据点来确定最近的数据点是否异常。Detect anomalies in your streaming data by using previously seen data points to determine if your latest one is an anomaly. 此操作使用发送的数据点生成一个模型,然后确定目标点是否异常。This operation generates a model using the data points you send, and determines if the target point is an anomaly. 每生成一个新数据点就调用该 API,这样就可以在创建数据时监视数据。By calling the API with each new data point you generate, you can monitor your data as it's created.
以批的形式检测整个数据集中的异常。Detect anomalies throughout your data set as a batch. 使用时序来检测数据中可能存在的任何异常。Use your time series to detect any anomalies that might exist throughout your data. 此操作使用整个时序数据生成一个模型,每个点使用同一模型进行分析。This operation generates a model using your entire time series data, with each point analyzed with the same model.
以批的形式检测整个数据集中的更改点。Detect change points throughout your data set as a batch. 使用时序来检测数据中存在的趋势更改点。Use your time series to detect any trend change points that exist in your data. 此操作使用整个时序数据生成一个模型,每个点使用同一模型进行分析。This operation generates a model using your entire time series data, with each point analyzed with the same model.
获取数据的其他信息。Get additional information about your data. 获取有关数据的有用详细信息以及任何观察到的异常,包括预期的值、异常边界和位置。Get useful details about your data and any observed anomalies, including expected values, anomaly boundaries, and positions.
调整异常检测边界。Adjust anomaly detection boundaries. 异常检测器 API 自动创建异常检测的边界。The Anomaly Detector API automatically creates boundaries for anomaly detection. 调整这些边界,以便提高或降低 API 对数据异常的敏感度,并更好地拟合数据。Adjust these boundaries to increase or decrease the API's sensitivity to data anomalies, and better fit your data.


查看此交互式演示以了解异常检测器的工作原理。Check out this interactive demo to understand how Anomaly Detector works. 若要运行演示,需要创建一个异常检测器资源,并获取 API 密钥和终结点。To run the demo, you need to create an Anomaly Detector resource and get the API key and endpoint.


若要了解如何调用异常检测器API,请试用此 NotebookTo learn how to call the Anomaly Detector API, try this Notebook. 此 Jupyter Notebook 演示如何发送 API 请求和直观显示结果。This Jupyter Notebook shows you how to send an API request and visualize the result.

若要运行此 Notebook,请完成以下步骤:To run the Notebook, complete the following steps:

  1. 获取一个有效的异常检测器 API 订阅密钥和一个 API 终结点。Get a valid Anomaly Detector API subscription key and an API endpoint. 以下部分提供注册说明。The section below has instructions for signing up.
  2. 登录,然后选择右上角的“克隆”。Sign in, and select Clone, in the upper right corner.
  3. 在完成克隆操作之前,请取消选中对话框中的“公共”选项,否则你的笔记本(包括任何订阅密钥)将是公共的。Uncheck the "public" option in the dialog box before completing the clone operation, otherwise your notebook, including any subscription keys, will be public.
  4. 选择“在免费计算上运行”Select Run on free compute
  5. 选择其中一个笔记本。Select one of the notebooks.
  6. subscription_key 变量添加有效的异常检测器 API 订阅密钥。Add your valid Anomaly Detector API subscription key to the subscription_key variable.
  7. endpoint 变量更改为你的终结点。Change the endpoint variable to your endpoint. 例如: https://api.cognitive.azure.cn/anomalydetector/v1.0/timeseries/last/detectFor example: https://api.cognitive.azure.cn/anomalydetector/v1.0/timeseries/last/detect
  8. 在顶部菜单栏中,依次选择“单元格”、“全部运行”。On the top menu bar, select Cell, then Run All.


异常检测器 API 是一项 RESTful Web 服务,可以轻松地通过任何编程语言调用,只要该语言能够发出 HTTP 请求和分析 JSON 即可。The Anomaly Detector API is a RESTful web service, making it easy to call from any programming language that can make HTTP requests and parse JSON.


为了在使用异常检测器 API 时达到最佳效果,JSON 格式的时间序列数据应包括:For best results when using the Anomaly Detector API, your JSON-formatted time series data should include:

  • 以相同间隔分隔的数据点,缺少的所需点数不超过 10%。data points separated by the same interval, with no more than 10% of the expected number of points missing.
  • 如果数据不具有明确的季节性模式,则至少有 12 个数据点。at least 12 data points if your data doesn't have a clear seasonal pattern.
  • 如果数据具有明确的季节性模式,则至少有 4 个模式匹配项。at least 4 pattern occurrences if your data does have a clear seasonal pattern.

必须有可以访问异常检测器 API 的认知服务 API 帐户You must have a Cognitive Services API account with access to the Anomaly Detector API. 创建帐户后,可以从 Azure 门户获取订阅密钥。You can get your subscription key from the Azure portal after creating your account.

注册后:After signing up:

  1. 获取时序数据并将其转换为有效的 JSON 格式。Take your time series data and convert it into a valid JSON format. 在准备数据时使用最佳做法,以便获取最佳结果。Use best practices when preparing your data to get the best results.
  2. 向包含你的数据的异常检测器 API 发送请求。Send a request to the Anomaly Detector API with your data.
  3. 通过分析返回的 JSON 消息处理 API 响应。Process the API response by parsing the returned JSON message.


可以阅读论文 Microsoft 的时序异常检测服务(KDD 2019 接受),详细了解 Microsoft 开发的 SR-CNN 算法。You can read the paper Time-Series Anomaly Detection Service at Microsoft (accepted by KDD 2019) to learn more about the SR-CNN algorithms developed by Microsoft.

服务可用性和冗余性Service availability and redundancy

异常检测器服务是否可在区域内复原?Is the Anomaly Detector service zone resilient?

是的。Yes. 默认情况下,异常探测器服务可在区域内复原。The Anomaly Detector service is zone-resilient by default.

如何将异常探测器服务配置为可在区域内复原?How do I configure the Anomaly Detector service to be zone-resilient?

客户无需配置即可启用区域复原能力。No customer configuration is necessary to enable zone-resiliency. 异常探测器资源默认提供区域内复原能力,由服务自身进行管理。Zone-resiliency for Anomaly Detector resources is available by default and managed by the service itself.

使用 Docker 容器进行本地部署Deploy on premises using Docker containers

使用异常检测器容器在本地部署 API 功能。Use Anomaly Detector containers to deploy API features on-premises. 借助 Docker 容器,你可使服务更靠近数据,以满足符合性、安全性或其他操作目的。Docker containers enable you to bring the service closer to your data for compliance, security, or other operational reasons.

加入“异常检测器”社区Join the Anomaly Detector community

后续步骤Next steps