Skip to content

Commit 0b8622d

Browse files
author
Rakshith Bhyravabhotla
authored
Release for Cognitive Services - Anomaly Detector (#12582)
* Release for Cognitive Services - Anomaly Detector * readme + setup * version + changelog * version * semver * Update sdk/cognitiveservices/azure-cognitiveservices-anomalydetector/CHANGELOG.md
1 parent 84e085d commit 0b8622d

23 files changed

+949
-740
lines changed

sdk/cognitiveservices/azure-cognitiveservices-anomalydetector/CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Release History
22

3+
## 0.3.0 (2020-07-23)
4+
5+
**Features**
6+
7+
- Added `change_point_detect` method to the client.
8+
- Added new models `ChangePointDetectRequest` and `ChangePointDetectResponse`
9+
310
## 0.2.0 (2019-04-12)
411

512
**Bugfixes**
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,21 @@
1-
## Microsoft Azure SDK for Python
1+
# Microsoft Azure SDK for Python
22

3-
This is the Microsoft Azure Cognitive Services Anomaly Detector Client
4-
Library.
3+
This is the Microsoft Azure Cognitive Services Anomaly Detector Client Library.
4+
This package has been tested with Python 2.7, 3.5, 3.6, 3.7 and 3.8.
5+
For a more complete view of Azure libraries, see the [Github repo](https://github.com/Azure/azure-sdk-for-python/)
56

6-
This package has been tested with Python 2.7, 3.4, 3.5, 3.6 and 3.7.
77

8-
For a more complete set of Azure libraries, see the
9-
[azure](https://pypi.python.org/pypi/azure) bundle package.
8+
# Usage
109

11-
## Usage
12-
13-
For code examples, see [Cognitive Services Anomaly
14-
Detector](https://docs.microsoft.com/python/api/overview/azure/cognitive-services)
10+
For code examples, see [Cognitive Services Anomaly Detector](https://docs.microsoft.com/python/api/overview/azure/cognitive-services)
1511
on docs.microsoft.com.
1612

17-
## Provide Feedback
1813

19-
If you encounter any bugs or have suggestions, please file an issue in
20-
the [Issues](https://github.com/Azure/azure-sdk-for-python/issues)
14+
# Provide Feedback
15+
16+
If you encounter any bugs or have suggestions, please file an issue in the
17+
[Issues](https://github.com/Azure/azure-sdk-for-python/issues)
2118
section of the project.
2219

23-
![image](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-cognitiveservices-anomalydetector%2FREADME.png)
20+
21+
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-cognitiveservices-anomalydetector%2FREADME.png)

sdk/cognitiveservices/azure-cognitiveservices-anomalydetector/azure/cognitiveservices/anomalydetector/__init__.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@
99
# regenerated.
1010
# --------------------------------------------------------------------------
1111

12-
from .anomaly_detector_client import AnomalyDetectorClient
13-
from .version import VERSION
12+
from ._configuration import AnomalyDetectorClientConfiguration
13+
from ._anomaly_detector_client import AnomalyDetectorClient
14+
__all__ = ['AnomalyDetectorClient', 'AnomalyDetectorClientConfiguration']
1415

15-
__all__ = ['AnomalyDetectorClient']
16+
from .version import VERSION
1617

1718
__version__ = VERSION
1819

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for
5+
# license information.
6+
#
7+
# Code generated by Microsoft (R) AutoRest Code Generator.
8+
# Changes may cause incorrect behavior and will be lost if the code is
9+
# regenerated.
10+
# --------------------------------------------------------------------------
11+
12+
from msrest.service_client import SDKClient
13+
from msrest import Serializer, Deserializer
14+
15+
from ._configuration import AnomalyDetectorClientConfiguration
16+
from .operations import AnomalyDetectorClientOperationsMixin
17+
from . import models
18+
19+
20+
class AnomalyDetectorClient(AnomalyDetectorClientOperationsMixin, SDKClient):
21+
"""The Anomaly Detector API detects anomalies automatically in time series data. It supports two kinds of mode, one is for stateless using, another is for stateful using. In stateless mode, there are three functionalities. Entire Detect is for detecting the whole series with model trained by the time series, Last Detect is detecting last point with model trained by points before. ChangePoint Detect is for detecting trend changes in time series. In stateful mode, user can store time series, the stored time series will be used for detection anomalies. Under this mode, user can still use the above three functionalities by only giving a time range without preparing time series in client side. Besides the above three functionalities, stateful model also provide group based detection and labeling service. By leveraging labeling service user can provide labels for each detection result, these labels will be used for retuning or regenerating detection models. Inconsistency detection is a kind of group based detection, this detection will find inconsistency ones in a set of time series. By using anomaly detector service, business customers can discover incidents and establish a logic flow for root cause analysis.
22+
23+
:ivar config: Configuration for client.
24+
:vartype config: AnomalyDetectorClientConfiguration
25+
26+
:param endpoint: Supported Cognitive Services endpoints (protocol and
27+
hostname, for example: https://westus2.api.cognitive.microsoft.com).
28+
:type endpoint: str
29+
:param credentials: Subscription credentials which uniquely identify
30+
client subscription.
31+
:type credentials: None
32+
"""
33+
34+
def __init__(
35+
self, endpoint, credentials):
36+
37+
self.config = AnomalyDetectorClientConfiguration(endpoint, credentials)
38+
super(AnomalyDetectorClient, self).__init__(self.config.credentials, self.config)
39+
40+
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
41+
self.api_version = '1.0'
42+
self._serialize = Serializer(client_models)
43+
self._deserialize = Deserializer(client_models)
44+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for
5+
# license information.
6+
#
7+
# Code generated by Microsoft (R) AutoRest Code Generator.
8+
# Changes may cause incorrect behavior and will be lost if the code is
9+
# regenerated.
10+
# --------------------------------------------------------------------------
11+
12+
from msrest import Configuration
13+
14+
from .version import VERSION
15+
16+
17+
class AnomalyDetectorClientConfiguration(Configuration):
18+
"""Configuration for AnomalyDetectorClient
19+
Note that all parameters used to create this instance are saved as instance
20+
attributes.
21+
22+
:param endpoint: Supported Cognitive Services endpoints (protocol and
23+
hostname, for example: https://westus2.api.cognitive.microsoft.com).
24+
:type endpoint: str
25+
:param credentials: Subscription credentials which uniquely identify
26+
client subscription.
27+
:type credentials: None
28+
"""
29+
30+
def __init__(
31+
self, endpoint, credentials):
32+
33+
if endpoint is None:
34+
raise ValueError("Parameter 'endpoint' must not be None.")
35+
if credentials is None:
36+
raise ValueError("Parameter 'credentials' must not be None.")
37+
base_url = '{Endpoint}/anomalydetector/v1.0'
38+
39+
super(AnomalyDetectorClientConfiguration, self).__init__(base_url)
40+
41+
# Starting Autorest.Python 4.0.64, make connection pool activated by default
42+
self.keep_alive = True
43+
44+
self.add_user_agent('azure-cognitiveservices-anomalydetector/{}'.format(VERSION))
45+
46+
self.endpoint = endpoint
47+
self.credentials = credentials

sdk/cognitiveservices/azure-cognitiveservices-anomalydetector/azure/cognitiveservices/anomalydetector/models/__init__.py

+19-13
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,32 @@
1010
# --------------------------------------------------------------------------
1111

1212
try:
13-
from .api_error_py3 import APIError, APIErrorException
14-
from .point_py3 import Point
15-
from .request_py3 import Request
16-
from .entire_detect_response_py3 import EntireDetectResponse
17-
from .last_detect_response_py3 import LastDetectResponse
13+
from ._models_py3 import APIError, APIErrorException
14+
from ._models_py3 import ChangePointDetectRequest
15+
from ._models_py3 import ChangePointDetectResponse
16+
from ._models_py3 import EntireDetectResponse
17+
from ._models_py3 import LastDetectResponse
18+
from ._models_py3 import Point
19+
from ._models_py3 import Request
1820
except (SyntaxError, ImportError):
19-
from .api_error import APIError, APIErrorException
20-
from .point import Point
21-
from .request import Request
22-
from .entire_detect_response import EntireDetectResponse
23-
from .last_detect_response import LastDetectResponse
24-
from .anomaly_detector_client_enums import (
21+
from ._models import APIError, APIErrorException
22+
from ._models import ChangePointDetectRequest
23+
from ._models import ChangePointDetectResponse
24+
from ._models import EntireDetectResponse
25+
from ._models import LastDetectResponse
26+
from ._models import Point
27+
from ._models import Request
28+
from ._anomaly_detector_client_enums import (
2529
Granularity,
2630
)
2731

2832
__all__ = [
2933
'APIError', 'APIErrorException',
30-
'Point',
31-
'Request',
34+
'ChangePointDetectRequest',
35+
'ChangePointDetectResponse',
3236
'EntireDetectResponse',
3337
'LastDetectResponse',
38+
'Point',
39+
'Request',
3440
'Granularity',
3541
]
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@ class Granularity(str, Enum):
2020
daily = "daily"
2121
hourly = "hourly"
2222
minutely = "minutely"
23+
secondly = "secondly"

0 commit comments

Comments
 (0)