Skip to content

Commit c958314

Browse files
Merge pull request #230547 from mrbullwinkle/mrb_03_14_2023_csharp_univariate
[Cognitive Services] [Anomaly Detector] C# univariate
2 parents 64ce0b7 + 73505d1 commit c958314

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

articles/cognitive-services/Anomaly-Detector/includes/quickstarts/anomaly-detector-client-library-csharp.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ author: mrbullwinkle
66
manager: nitinme
77
ms.service: cognitive-services
88
ms.topic: include
9-
ms.date: 10/04/2022
9+
ms.date: 03/14/2023
1010
ms.author: mbullwin
1111
---
1212

@@ -57,7 +57,7 @@ Build succeeded.
5757
Within the application directory, install the Anomaly Detector client library for .NET with the following command:
5858

5959
```dotnetcli
60-
dotnet add package Azure.AI.AnomalyDetector --version 3.0.0-preview.5
60+
dotnet add package Azure.AI.AnomalyDetector --prerelease
6161
```
6262

6363
## Retrieve key and endpoint
@@ -130,7 +130,6 @@ using System.Linq;
130130
using System.Text;
131131
using Azure;
132132
using Azure.AI.AnomalyDetector;
133-
using Azure.AI.AnomalyDetector.Models;
134133
using static System.Environment;
135134

136135
namespace anomaly_detector_quickstart
@@ -158,13 +157,13 @@ namespace anomaly_detector_quickstart
158157
.Where(e => e.Length == 2)
159158
.Select(e => new TimeSeriesPoint(float.Parse(e[1])) { Timestamp = DateTime.Parse(e[0]) }).ToList();
160159

161-
//create request
162-
DetectRequest request = new DetectRequest(list)
160+
//create request
161+
UnivariateDetectionOptions request = new UnivariateDetectionOptions(list)
163162
{
164163
Granularity = TimeGranularity.Daily
165164
};
166165

167-
EntireDetectResponse result = client.DetectEntireSeries(request);
166+
UnivariateEntireDetectionResult result = client.DetectUnivariateEntireSeries(request);
168167

169168
bool hasAnomaly = false;
170169
for (int i = 0; i < request.Series.Count; ++i)
@@ -183,11 +182,16 @@ namespace anomaly_detector_quickstart
183182
}
184183
}
185184

185+
186186
```
187187

188188
> [!IMPORTANT]
189189
> For production, use a secure way of storing and accessing your credentials like [Azure Key Vault](../../../../key-vault/general/overview.md). For more information about credential security, see the Cognitive Services [security](../../../security-features.md) article.
190190
191+
```cmd
192+
dotnet run program.cs
193+
```
194+
191195
### Output
192196

193197
```console

0 commit comments

Comments
 (0)