@@ -6,7 +6,7 @@ author: mrbullwinkle
6
6
manager : nitinme
7
7
ms.service : cognitive-services
8
8
ms.topic : include
9
- ms.date : 10/13 /2022
9
+ ms.date : 12/16 /2022
10
10
ms.author : mbullwin
11
11
recommendations : false
12
12
---
@@ -102,7 +102,7 @@ curl "https://raw.githubusercontent.com/Azure/azure-sdk-for-python/main/sdk/anom
102
102
103
103
``` python
104
104
from azure.ai.anomalydetector import AnomalyDetectorClient
105
- from azure.ai.anomalydetector.models import DetectRequest, TimeSeriesPoint, TimeGranularity
105
+ from azure.ai.anomalydetector.models import *
106
106
from azure.core.credentials import AzureKeyCredential
107
107
import pandas as pd
108
108
import os
@@ -111,17 +111,17 @@ curl "https://raw.githubusercontent.com/Azure/azure-sdk-for-python/main/sdk/anom
111
111
ENDPOINT = os.environ[' ANOMALY_DETECTOR_ENDPOINT' ]
112
112
DATA_PATH = " REPLACE_WITH_YOUR_LOCAL_SAMPLE_REQUEST_DATA_PATH" # example: c:\\test\\request-data.csv
113
113
114
- client = AnomalyDetectorClient(AzureKeyCredential(API_KEY ), ENDPOINT )
114
+ client = AnomalyDetectorClient(ENDPOINT , AzureKeyCredential(API_KEY ))
115
115
116
116
series = []
117
117
data_file = pd.read_csv(DATA_PATH , header = None , encoding = ' utf-8' , date_parser = [0 ])
118
118
for index, row in data_file.iterrows():
119
119
series.append(TimeSeriesPoint(timestamp = row[0 ], value = row[1 ]))
120
120
121
- request = DetectRequest (series = series, granularity = TimeGranularity.daily )
121
+ request = UnivariateDetectionOptions (series = series, granularity = TimeGranularity.DAILY )
122
122
123
- change_point_response = client.detect_change_point (request)
124
- anomaly_response = client.detect_entire_series (request)
123
+ change_point_response = client.detect_univariate_change_point (request)
124
+ anomaly_response = client.detect_univariate_entire_series (request)
125
125
126
126
for i in range (len (data_file.values)):
127
127
if (change_point_response.is_change_point[i]):
@@ -180,7 +180,7 @@ To visualize the anomalies and change points in relation to the sample data seri
180
180
181
181
```python
182
182
from azure.ai.anomalydetector import AnomalyDetectorClient
183
- from azure.ai.anomalydetector.models import DetectRequest, TimeSeriesPoint, TimeGranularity
183
+ from azure.ai.anomalydetector.models import *
184
184
from azure.core.credentials import AzureKeyCredential
185
185
import pandas as pd
186
186
import matplotlib.pyplot as plt
@@ -190,17 +190,17 @@ To visualize the anomalies and change points in relation to the sample data seri
190
190
ENDPOINT = os.environ['ANOMALY_DETECTOR_ENDPOINT']
191
191
DATA_PATH = "REPLACE_WITH_YOUR_LOCAL_SAMPLE_REQUEST_DATA_PATH" #example: c:\\test\\request-data.csv
192
192
193
- client = AnomalyDetectorClient(AzureKeyCredential(API_KEY), ENDPOINT )
193
+ client = AnomalyDetectorClient(ENDPOINT, AzureKeyCredential(API_KEY))
194
194
195
195
series = []
196
196
data_file = pd.read_csv(DATA_PATH, header=None, encoding='utf-8', date_parser=[0])
197
197
for index, row in data_file.iterrows():
198
198
series.append(TimeSeriesPoint(timestamp=row[0], value=row[1]))
199
199
200
- request = DetectRequest (series=series, granularity=TimeGranularity.daily )
200
+ request = UnivariateDetectionOptions (series=series, granularity=TimeGranularity.DAILY )
201
201
202
- change_point_response = client.detect_change_point (request)
203
- anomaly_response = client.detect_entire_series (request)
202
+ change_point_response = client.detect_univariate_change_point (request)
203
+ anomaly_response = client.detect_univariate_entire_series (request)
204
204
205
205
for i in range(len(data_file.values)):
206
206
temp_date_to_num = mdates.date2num(data_file.values[i])
0 commit comments