forked from Azure/azure-sdk-for-python
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[xingyuyue/multi_ad_sample] add multivariate anomaly detetor sample f… (
Azure#26783) * [xingyuyue/multi_ad_sample] add multivariate anomaly detetor sample for v1.1 * [xingyuyue/multi_ad_sample] fix anomaly detetor sample for v1.1-preview * [xingyuyue/multi_ad_sample] fix comments * Fix aio client * Fix APIView * Update anomalydetector sdk * [xingyuyue/multi_ad_sample] update SDK code * [xingyuyue/multi_ad_sample] remove azure-ai-anomalydetector-new * Update change log * Update changelog * Update changelog * Update changelog * Add anomalydetector to cspell * Override dependencies for anomalydetector to resolve ci errors * Update ci yaml for anomalydetector * Update anomalydetector python sdk * [xingyuyue/multi_ad_sample] update sdk code * [xingyuyue/multi_ad_sample] fix sample get error code and message * Update dependencies for anomalydetector * Update dependencies for anomalydetector * Update dependencies for anomalydetector * Fix typo * Fix type-extensions troubles * [xingyuyue/multi_ad_sample] fix ci, readme and shared requirements * Update sdk * [xingyuyue/multi_ad_sample] update sdk sample * Update change log * [xingyuyue/multi_ad_sample] update sdk code and sample * [xingyuyue/multi_ad_sample] update sdk async api * Add Python 3.11 classifier * update changelog.md to add release date * [xingyuyue/multi_ad_sample] remove api version in client and update readme * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md Co-authored-by: Laurent Mazuel <[email protected]> Co-authored-by: Chunlei Wang <[email protected]> Co-authored-by: Laurent Mazuel <[email protected]> Co-authored-by: jr-MS <[email protected]>
- Loading branch information
1 parent
3b1c811
commit 099878e
Showing
40 changed files
with
12,097 additions
and
5,488 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 16 additions & 10 deletions
26
sdk/anomalydetector/azure-ai-anomalydetector/CHANGELOG.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
recursive-include tests *.py *.yaml | ||
recursive-include samples *.py *.md | ||
include *.md | ||
include LICENSE | ||
include azure/__init__.py | ||
include azure/ai/__init__.py | ||
include azure/ai/anomalydetector/py.typed | ||
recursive-include tests *.py | ||
recursive-include samples *.py *.md | ||
include azure/__init__.py | ||
include azure/ai/__init__.py |
250 changes: 203 additions & 47 deletions
250
sdk/anomalydetector/azure-ai-anomalydetector/README.md
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__path__ = __import__('pkgutil').extend_path(__path__, __name__) | ||
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore |
2 changes: 1 addition & 1 deletion
2
sdk/anomalydetector/azure-ai-anomalydetector/azure/ai/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__path__ = __import__('pkgutil').extend_path(__path__, __name__) | ||
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
98 changes: 0 additions & 98 deletions
98
...alydetector/azure-ai-anomalydetector/azure/ai/anomalydetector/_anomaly_detector_client.py
This file was deleted.
Oops, something went wrong.
100 changes: 100 additions & 0 deletions
100
sdk/anomalydetector/azure-ai-anomalydetector/azure/ai/anomalydetector/_client.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
# coding=utf-8 | ||
# -------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See License.txt in the project root for license information. | ||
# Code generated by Microsoft (R) AutoRest Code Generator. | ||
# Changes may cause incorrect behavior and will be lost if the code is regenerated. | ||
# -------------------------------------------------------------------------- | ||
|
||
from copy import deepcopy | ||
import sys | ||
from typing import Any | ||
|
||
from azure.core import PipelineClient | ||
from azure.core.credentials import AzureKeyCredential | ||
from azure.core.rest import HttpRequest, HttpResponse | ||
|
||
from ._configuration import AnomalyDetectorClientConfiguration | ||
from ._operations import AnomalyDetectorClientOperationsMixin | ||
from ._serialization import Deserializer, Serializer | ||
|
||
if sys.version_info >= (3, 8): | ||
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports | ||
else: | ||
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports | ||
|
||
|
||
class AnomalyDetectorClient(AnomalyDetectorClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword | ||
"""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. | ||
:param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for example: | ||
https://westus2.api.cognitive.microsoft.com). Required. | ||
:type endpoint: str | ||
:param credential: Credential needed for the client to connect to Azure. Required. | ||
:type credential: ~azure.core.credentials.AzureKeyCredential | ||
:keyword api_version: Api Version. Default value is "v1.1". Note that overriding this default | ||
value may result in unsupported behavior. | ||
:paramtype api_version: str | ||
""" | ||
|
||
def __init__(self, endpoint: str, credential: AzureKeyCredential, **kwargs: Any) -> None: | ||
_endpoint = "{Endpoint}/anomalydetector/{ApiVersion}" | ||
self._config = AnomalyDetectorClientConfiguration(endpoint=endpoint, credential=credential, **kwargs) | ||
self._client = PipelineClient(base_url=_endpoint, config=self._config, **kwargs) | ||
|
||
self._serialize = Serializer() | ||
self._deserialize = Deserializer() | ||
self._serialize.client_side_validation = False | ||
|
||
def send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: | ||
"""Runs the network request through the client's chained policies. | ||
>>> from azure.core.rest import HttpRequest | ||
>>> request = HttpRequest("GET", "https://www.example.org/") | ||
<HttpRequest [GET], url: 'https://www.example.org/'> | ||
>>> response = client.send_request(request) | ||
<HttpResponse: 200 OK> | ||
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request | ||
:param request: The network request you want to make. Required. | ||
:type request: ~azure.core.rest.HttpRequest | ||
:keyword bool stream: Whether the response payload will be streamed. Defaults to False. | ||
:return: The response of your network call. Does not do error handling on your response. | ||
:rtype: ~azure.core.rest.HttpResponse | ||
""" | ||
|
||
request_copy = deepcopy(request) | ||
path_format_arguments = { | ||
"Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), | ||
"ApiVersion": self._serialize.url("self._config.api_version", self._config.api_version, "str"), | ||
} | ||
|
||
request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) | ||
return self._client.send_request(request_copy, **kwargs) | ||
|
||
def close(self): | ||
# type: () -> None | ||
self._client.close() | ||
|
||
def __enter__(self): | ||
# type: () -> AnomalyDetectorClient | ||
self._client.__enter__() | ||
return self | ||
|
||
def __exit__(self, *exc_details): | ||
# type: (Any) -> None | ||
self._client.__exit__(*exc_details) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.