Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,348 @@
{
"swagger": "2.0",
"info": {
"version": "1.0",
"title": "Anomaly Detector Client",
"description": "The Anomaly Detector API detects anomalies automatically in time series data. It supports two functionalities, one is for detecting the whole series with model trained by the timeseries, another is detecting last point with model trained by points before. By using this service, business customers can discover incidents and establish a logic flow for root cause analysis."
},
"securityDefinitions": {
"apiKeyHeader": {
"type": "apiKey",
"name": "Ocp-Apim-Subscription-Key",
"in": "header"
}
},
"security": [
{
"apiKeyHeader": []
}
],
"x-ms-parameterized-host": {
"hostTemplate": "{Endpoint}/anomalydetector/v1.0",
"useSchemePrefix": false,
"parameters": [
{
"$ref": "#/parameters/Endpoint"
}
]
},
"paths": {
"/timeseries/entire/detect": {
"post": {
"summary": "Detect anomalies for the entire series in batch.",
"description": "This operation generates a model using an entire series, each point is detected with the same model. With this method, points before and after a certain point are used to determine whether it is an anomaly. The entire detection can give user an overall status of the time series.",
"operationId": "EntireDetect",
"parameters": [
{
"name": "body",
"in": "body",
"description": "Time series points and period if needed. Advanced model parameters can also be set in the request.",
"required": true,
"schema": {
"$ref": "#/definitions/Request"
}
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"responses": {
"200": {
"description": "Successful operation.",
"schema": {
"$ref": "#/definitions/EntireDetectResponse"
}
},
"default": {
"description": "Error response.",
"schema": {
"$ref": "#/definitions/APIError"
}
}
},
"x-ms-examples": {
"Find anomalies for the entire series in batch example": {
"$ref": "./examples/EntireDetect.json"
}
}
}
},
"/timeseries/last/detect": {
"post": {
"summary": "Detect anomaly status of the latest point in time series.",
"description": "This operation generates a model using points before the latest one. With this method, only historical points are used to determine whether the target point is an anomaly. The latest point detecting operation matches the scenario of real-time monitoring of business metrics.",
"operationId": "LastDetect",
"parameters": [
{
"name": "body",
"in": "body",
"description": "Time series points and period if needed. Advanced model parameters can also be set in the request.",
"required": true,
"schema": {
"$ref": "#/definitions/Request"
}
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"responses": {
"200": {
"description": "Successful operation.",
"schema": {
"$ref": "#/definitions/LastDetectResponse"
}
},
"default": {
"description": "Error response.",
"schema": {
"$ref": "#/definitions/APIError"
}
}
},
"x-ms-examples": {
"Detect anomaly status of the latest point in time series example": {
"$ref": "./examples/LastDetect.json"
}
}
}
}
},
"definitions": {
"APIError": {
"type": "object",
"description": "Error information returned by the API.",
"properties": {
"code": {
"description": "The error code.",
"enum": [
"InvalidCustomInterval",
"BadArgument",
"InvalidGranularity",
"InvalidPeriod",
"InvalidModelArgument",
"InvalidSeries"
],
"x-ms-enum": {
"name": "AnomalyDetectorErrorCodes",
"modelAsString": true
}
},
"message": {
"description": "A message explaining the error reported by the service.",
"type": "string"
}
}
},
"Request": {
"type": "object",
"required": [
"granularity",
"series"
],
"properties": {
"series": {
"type": "array",
"description": "Time series data points. Points should be sorted by timestamp in ascending order to match the anomaly detection result. If the data is not sorted correctly or there is duplicated timestamp, the API will not work. In such case, an error message will be returned.",
"items": {
"$ref": "#/definitions/Point"
}
},
"granularity": {
"type": "string",
"description": "Can only be one of yearly, monthly, weekly, daily, hourly or minutely. Granularity is used for verify whether input series is valid.",
"x-ms-enum": {
"name": "Granularity",
"modelAsString": false
},
"enum": [
"yearly",
"monthly",
"weekly",
"daily",
"hourly",
"minutely"
]
},
"customInterval": {
"type": "integer",
"format": "int32",
"description": "Custom Interval is used to set non-standard time interval, for example, if the series is 5 minutes, request can be set as {\"granularity\":\"minutely\", \"customInterval\":5}."
},
"period": {
"type": "integer",
"format": "int32",
"description": "Optional argument, periodic value of a time series. If the value is null or does not present, the API will determine the period automatically."
},
"maxAnomalyRatio": {
"type": "number",
"format": "float",
"description": "Optional argument, advanced model parameter, max anomaly ratio in a time series."
},
"sensitivity": {
"type": "integer",
"format": "int32",
"description": "Optional argument, advanced model parameter, between 0-99, the lower the value is, the larger the margin value will be which means less anomalies will be accepted."
}
}
},
"Point": {
"type": "object",
"required": [
"timestamp",
"value"
],
"properties": {
"timestamp": {
"type": "string",
"format": "date-time",
"description": "Timestamp of a data point (ISO8601 format)."
},
"value": {
"type": "number",
"format": "float",
"description": "The measurement of that point, should be float."
}
}
},
"EntireDetectResponse": {
"type": "object",
"required": [
"expectedValues",
"isAnomaly",
"isNegativeAnomaly",
"isPositiveAnomaly",
"lowerMargins",
"period",
"upperMargins"
],
"properties": {
"period": {
"type": "integer",
"format": "int32",
"description": "Frequency extracted from the series, zero means no recurrent pattern has been found."
},
"expectedValues": {
"type": "array",
"description": "ExpectedValues contain expected value for each input point. The index of the array is consistent with the input series.",
"items": {
"type": "number",
"format": "float",
"x-nullable": false
}
},
"upperMargins": {
"type": "array",
"description": "UpperMargins contain upper margin of each input point. UpperMargin is used to calculate upperBoundary, which equals to expectedValue + (100 - marginScale)*upperMargin. Anomalies in response can be filtered by upperBoundary and lowerBoundary. By adjusting marginScale value, less significant anomalies can be filtered in client side. The index of the array is consistent with the input series.",
"items": {
"type": "number",
"format": "float",
"x-nullable": false
}
},
"lowerMargins": {
"type": "array",
"description": "LowerMargins contain lower margin of each input point. LowerMargin is used to calculate lowerBoundary, which equals to expectedValue - (100 - marginScale)*lowerMargin. Points between the boundary can be marked as normal ones in client side. The index of the array is consistent with the input series.",
"items": {
"type": "number",
"format": "float",
"x-nullable": false
}
},
"isAnomaly": {
"type": "array",
"description": "IsAnomaly contains anomaly properties for each input point. True means an anomaly either negative or positive has been detected. The index of the array is consistent with the input series.",
"items": {
"type": "boolean",
"x-nullable": false
}
},
"isNegativeAnomaly": {
"type": "array",
"description": "IsNegativeAnomaly contains anomaly status in negative direction for each input point. True means a negative anomaly has been detected. A negative anomaly means the point is detected as an anomaly and its real value is smaller than the expected one. The index of the array is consistent with the input series.",
"items": {
"type": "boolean",
"x-nullable": false
}
},
"isPositiveAnomaly": {
"type": "array",
"description": "IsPositiveAnomaly contain anomaly status in positive direction for each input point. True means a positive anomaly has been detected. A positive anomaly means the point is detected as an anomaly and its real value is larger than the expected one. The index of the array is consistent with the input series.",
"items": {
"type": "boolean",
"x-nullable": false
}
}
}
},
"LastDetectResponse": {
"type": "object",
"required": [
"expectedValue",
"isAnomaly",
"isNegativeAnomaly",
"isPositiveAnomaly",
"lowerMargin",
"period",
"upperMargin",
"suggestedWindow"
],
"properties": {
"period": {
"type": "integer",
"format": "int32",
"description": "Frequency extracted from the series, zero means no recurrent pattern has been found."
},
"suggestedWindow": {
"type": "integer",
"format": "int32",
"description": "Suggested input series points needed for detecting the latest point."
},
"expectedValue": {
"type": "number",
"format": "float",
"description": "Expected value of the latest point."
},
"upperMargin": {
"type": "number",
"format": "float",
"description": "Upper margin of the latest point. UpperMargin is used to calculate upperBoundary, which equals to expectedValue + (100 - marginScale)*upperMargin. If the value of latest point is between upperBoundary and lowerBoundary, it should be treated as normal value. By adjusting marginScale value, anomaly status of latest point can be changed."
},
"lowerMargin": {
"type": "number",
"format": "float",
"description": "Lower margin of the latest point. LowerMargin is used to calculate lowerBoundary, which equals to expectedValue - (100 - marginScale)*lowerMargin. "
},
"isAnomaly": {
"type": "boolean",
"description": "Anomaly status of the latest point, true means the latest point is an anomaly either in negative direction or positive direction."
},
"isNegativeAnomaly": {
"type": "boolean",
"description": "Anomaly status in negative direction of the latest point. True means the latest point is an anomaly and its real value is smaller than the expected one."
},
"isPositiveAnomaly": {
"type": "boolean",
"description": "Anomaly status in positive direction of the latest point. True means the latest point is an anomaly and its real value is larger than the expected one."
}
}
}
},
"parameters": {
"Endpoint": {
"name": "Endpoint",
"description": "Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus2.api.cognitive.microsoft.com).",
"x-ms-parameter-location": "client",
"required": true,
"type": "string",
"in": "path",
"x-ms-skip-url-encoding": true
}
}
}
Loading