Skip to content

Commit

Permalink
[Anomaly Detector] Move sample code under the right snippet (Azure#15003
Browse files Browse the repository at this point in the history
)

[Anomaly Detector] Move code under the right snippet
  • Loading branch information
ShivangiReja authored Sep 9, 2020
1 parent 1769c1d commit 0e50e85
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ var credential = new AzureKeyCredential(apiKey);

//create client
AnomalyDetectorClient client = new AnomalyDetectorClient(endpointUri, credential);

//read data
string datapath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "samples", "data", "request-data.csv");
```

## Load time series and create DetectRequest
Expand All @@ -33,6 +30,9 @@ Call `File.ReadAllLines` with the file path and create a list of `TimeSeriesPoin
Make a `DetectRequest` object with the series of points, and `TimeGranularity.Daily` for the granularity (or periodicity) of the data points.

```C# Snippet:ReadSeriesData
//read data
string datapath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "samples", "data", "request-data.csv");

List<TimeSeriesPoint> list = File.ReadAllLines(datapath, Encoding.UTF8)
.Where(e => e.Trim().Length != 0)
.Select(e => e.Split(','))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ var credential = new AzureKeyCredential(apiKey);

//create client
AnomalyDetectorClient client = new AnomalyDetectorClient(endpointUri, credential);

//read data
string datapath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "samples", "data", "request-data.csv");
```

## Load time series and create DetectRequest
Expand All @@ -33,6 +30,9 @@ Call `File.ReadAllLines` with the file path and create a list of `TimeSeriesPoin
Make a `DetectRequest` object with the series of points, and `TimeGranularity.Daily` for the granularity (or periodicity) of the data points.

```C# Snippet:ReadSeriesData
//read data
string datapath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "samples", "data", "request-data.csv");

List<TimeSeriesPoint> list = File.ReadAllLines(datapath, Encoding.UTF8)
.Where(e => e.Trim().Length != 0)
.Select(e => e.Split(','))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ var credential = new AzureKeyCredential(apiKey);

//create client
AnomalyDetectorClient client = new AnomalyDetectorClient(endpointUri, credential);

//read data
string datapath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "samples", "data", "request-data.csv");
```

## Load time series and create ChangePointDetectRequest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ public async Task DetectEntireSeriesAnomaly()
//create client
AnomalyDetectorClient client = new AnomalyDetectorClient(endpointUri, credential);

//read data
string datapath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "samples", "data", "request-data.csv");

#endregion

#region Snippet:ReadSeriesData

//read data
string datapath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "samples", "data", "request-data.csv");

List<TimeSeriesPoint> list = File.ReadAllLines(datapath, Encoding.UTF8)
.Where(e => e.Trim().Length != 0)
.Select(e => e.Split(','))
Expand Down

0 comments on commit 0e50e85

Please sign in to comment.