Skip to content

Commit

Permalink
Update cadl version of Anomaly Detector (Azure#32862)
Browse files Browse the repository at this point in the history
* Update cadl version

* Update API

* FiX

* Fix

* Update

* Fix

* Update
  • Loading branch information
pshao25 authored Dec 6, 2022
1 parent c8b30db commit 3bc773a
Show file tree
Hide file tree
Showing 35 changed files with 202 additions and 203 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -172,4 +172,7 @@ msbuild.binlog
BenchmarkDotNet.Artifacts

artifacts
.assets
.assets

# Temporary cadl folders for cadl generation
TempCadlFiles/
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ public AnomalyDetectorClient(System.Uri endpoint, Azure.AzureKeyCredential crede
public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } }
public virtual Azure.Response DeleteMultivariateModel(string modelId, Azure.RequestContext context = null) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response> DeleteMultivariateModelAsync(string modelId, Azure.RequestContext context = null) { throw null; }
public virtual Azure.Response<Azure.AI.AnomalyDetector.MultivariateDetectionResult> DetectMultivariateBatchAnomaly(string modelId, Azure.AI.AnomalyDetector.MultivariateDetectionOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Response<Azure.AI.AnomalyDetector.MultivariateDetectionResult> DetectMultivariateBatchAnomaly(string modelId, Azure.AI.AnomalyDetector.MultivariateBatchDetectionOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Response DetectMultivariateBatchAnomaly(string modelId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.AI.AnomalyDetector.MultivariateDetectionResult>> DetectMultivariateBatchAnomalyAsync(string modelId, Azure.AI.AnomalyDetector.MultivariateDetectionOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.AI.AnomalyDetector.MultivariateDetectionResult>> DetectMultivariateBatchAnomalyAsync(string modelId, Azure.AI.AnomalyDetector.MultivariateBatchDetectionOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response> DetectMultivariateBatchAnomalyAsync(string modelId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; }
public virtual Azure.Response<Azure.AI.AnomalyDetector.MultivariateLastDetectionResult> DetectMultivariateLastAnomaly(string modelId, Azure.AI.AnomalyDetector.MultivariateLastDetectionOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Response DetectMultivariateLastAnomaly(string modelId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; }
Expand All @@ -40,9 +40,9 @@ public AnomalyDetectorClient(System.Uri endpoint, Azure.AzureKeyCredential crede
public virtual Azure.Response DetectUnivariateChangePoint(Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.AI.AnomalyDetector.UnivariateChangePointDetectionResult>> DetectUnivariateChangePointAsync(Azure.AI.AnomalyDetector.UnivariateChangePointDetectionOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response> DetectUnivariateChangePointAsync(Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; }
public virtual Azure.Response<Azure.AI.AnomalyDetector.UnivariateDetectionResult> DetectUnivariateEntireSeries(Azure.AI.AnomalyDetector.UnivariateDetectionOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Response<Azure.AI.AnomalyDetector.UnivariateEntireDetectionResult> DetectUnivariateEntireSeries(Azure.AI.AnomalyDetector.UnivariateDetectionOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Response DetectUnivariateEntireSeries(Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.AI.AnomalyDetector.UnivariateDetectionResult>> DetectUnivariateEntireSeriesAsync(Azure.AI.AnomalyDetector.UnivariateDetectionOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.AI.AnomalyDetector.UnivariateEntireDetectionResult>> DetectUnivariateEntireSeriesAsync(Azure.AI.AnomalyDetector.UnivariateDetectionOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response> DetectUnivariateEntireSeriesAsync(Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; }
public virtual Azure.Response<Azure.AI.AnomalyDetector.UnivariateLastDetectionResult> DetectUnivariateLastPoint(Azure.AI.AnomalyDetector.UnivariateDetectionOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Response DetectUnivariateLastPoint(Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; }
Expand Down Expand Up @@ -100,10 +100,23 @@ public partial class CorrelationChanges
internal CorrelationChanges() { }
public System.Collections.Generic.IReadOnlyList<string> ChangedVariables { get { throw null; } }
}
public enum DataSchema
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public readonly partial struct DataSchema : System.IEquatable<Azure.AI.AnomalyDetector.DataSchema>
{
OneTable = 0,
MultiTable = 1,
private readonly object _dummy;
private readonly int _dummyPrimitive;
public DataSchema(string value) { throw null; }
public static Azure.AI.AnomalyDetector.DataSchema MultiTable { get { throw null; } }
public static Azure.AI.AnomalyDetector.DataSchema OneTable { get { throw null; } }
public bool Equals(Azure.AI.AnomalyDetector.DataSchema other) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public override bool Equals(object obj) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public override int GetHashCode() { throw null; }
public static bool operator ==(Azure.AI.AnomalyDetector.DataSchema left, Azure.AI.AnomalyDetector.DataSchema right) { throw null; }
public static implicit operator Azure.AI.AnomalyDetector.DataSchema (string value) { throw null; }
public static bool operator !=(Azure.AI.AnomalyDetector.DataSchema left, Azure.AI.AnomalyDetector.DataSchema right) { throw null; }
public override string ToString() { throw null; }
}
public partial class DiagnosticsInfo
{
Expand Down Expand Up @@ -169,7 +182,7 @@ public ModelInfo(string dataSource, System.DateTimeOffset startTime, System.Date
public Azure.AI.AnomalyDetector.DiagnosticsInfo DiagnosticsInfo { get { throw null; } set { } }
public string DisplayName { get { throw null; } set { } }
public System.DateTimeOffset EndTime { get { throw null; } set { } }
public System.Collections.Generic.IList<Azure.AI.AnomalyDetector.ErrorResponse> Errors { get { throw null; } }
public System.Collections.Generic.IReadOnlyList<Azure.AI.AnomalyDetector.ErrorResponse> Errors { get { throw null; } }
public int? SlidingWindow { get { throw null; } set { } }
public System.DateTimeOffset StartTime { get { throw null; } set { } }
public Azure.AI.AnomalyDetector.ModelStatus? Status { get { throw null; } set { } }
Expand All @@ -189,36 +202,36 @@ public enum ModelStatus
Ready = 2,
Failed = 3,
}
public partial class MultivariateDetectionOptions
public partial class MultivariateBatchDetectionOptions
{
public MultivariateDetectionOptions(string dataSource, int topContributorCount, System.DateTimeOffset startTime, System.DateTimeOffset endTime) { }
public MultivariateBatchDetectionOptions(string dataSource, int topContributorCount, System.DateTimeOffset startTime, System.DateTimeOffset endTime) { }
public string DataSource { get { throw null; } set { } }
public System.DateTimeOffset EndTime { get { throw null; } set { } }
public System.DateTimeOffset StartTime { get { throw null; } set { } }
public int TopContributorCount { get { throw null; } set { } }
}
public partial class MultivariateDetectionResult
public partial class MultivariateBatchDetectionResultSummary
{
internal MultivariateDetectionResult() { }
public string ResultId { get { throw null; } }
public System.Collections.Generic.IReadOnlyList<Azure.AI.AnomalyDetector.AnomalyState> Results { get { throw null; } }
public Azure.AI.AnomalyDetector.MultivariateDetectionResultSummary Summary { get { throw null; } }
}
public partial class MultivariateDetectionResultSummary
{
internal MultivariateDetectionResultSummary() { }
internal MultivariateBatchDetectionResultSummary() { }
public System.Collections.Generic.IReadOnlyList<Azure.AI.AnomalyDetector.ErrorResponse> Errors { get { throw null; } }
public Azure.AI.AnomalyDetector.MultivariateDetectionOptions SetupInfo { get { throw null; } }
public Azure.AI.AnomalyDetector.MultivariateDetectionStatus Status { get { throw null; } }
public Azure.AI.AnomalyDetector.MultivariateBatchDetectionOptions SetupInfo { get { throw null; } }
public Azure.AI.AnomalyDetector.MultivariateBatchDetectionStatus Status { get { throw null; } }
public System.Collections.Generic.IReadOnlyList<Azure.AI.AnomalyDetector.VariableState> VariableStates { get { throw null; } }
}
public enum MultivariateDetectionStatus
public enum MultivariateBatchDetectionStatus
{
Created = 0,
Running = 1,
Ready = 2,
Failed = 3,
}
public partial class MultivariateDetectionResult
{
internal MultivariateDetectionResult() { }
public string ResultId { get { throw null; } }
public System.Collections.Generic.IReadOnlyList<Azure.AI.AnomalyDetector.AnomalyState> Results { get { throw null; } }
public Azure.AI.AnomalyDetector.MultivariateBatchDetectionResultSummary Summary { get { throw null; } }
}
public partial class MultivariateLastDetectionOptions
{
public MultivariateLastDetectionOptions(System.Collections.Generic.IEnumerable<Azure.AI.AnomalyDetector.VariableValues> variables, int topContributorCount) { }
Expand Down Expand Up @@ -278,9 +291,9 @@ public UnivariateDetectionOptions(System.Collections.Generic.IEnumerable<Azure.A
public int? Sensitivity { get { throw null; } set { } }
public System.Collections.Generic.IList<Azure.AI.AnomalyDetector.TimeSeriesPoint> Series { get { throw null; } }
}
public partial class UnivariateDetectionResult
public partial class UnivariateEntireDetectionResult
{
internal UnivariateDetectionResult() { }
internal UnivariateEntireDetectionResult() { }
public System.Collections.Generic.IReadOnlyList<float> ExpectedValues { get { throw null; } }
public System.Collections.Generic.IReadOnlyList<bool> IsAnomaly { get { throw null; } }
public System.Collections.Generic.IReadOnlyList<bool> IsNegativeAnomaly { get { throw null; } }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Console.WriteLine("Detecting anomalies in the entire time series.");

try
{
UnivariateDetectionResult result = client.DetectUnivariateEntireSeries(request);
UnivariateEntireDetectionResult result = client.DetectUnivariateEntireSeries(request);

bool hasAnomaly = false;
for (int i = 0; i < request.Series.Count; ++i)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ private MultivariateDetectionResult BatchDetect(AnomalyDetectorClient client, st
try
{
Console.WriteLine("Start batch detect...");
MultivariateDetectionOptions request = new MultivariateDetectionOptions(datasource, 10, start_time, end_time);
MultivariateBatchDetectionOptions request = new MultivariateBatchDetectionOptions(datasource, 10, start_time, end_time);

TestContext.Progress.WriteLine("Start batch detection, this might take a few minutes...");
MultivariateDetectionResult response = client.DetectMultivariateBatchAnomaly(model_id, request);
Expand All @@ -109,9 +109,9 @@ private MultivariateDetectionResult BatchDetect(AnomalyDetectorClient client, st

// get detection result
MultivariateDetectionResult resultResponse = client.GetMultivariateBatchDetectionResultValue(result_id);
MultivariateDetectionStatus result_status = resultResponse.Summary.Status;
MultivariateBatchDetectionStatus result_status = resultResponse.Summary.Status;
int tryout_count = 0;
while (tryout_count < max_tryout & result_status != MultivariateDetectionStatus.Ready & result_status != MultivariateDetectionStatus.Failed)
while (tryout_count < max_tryout & result_status != MultivariateBatchDetectionStatus.Ready & result_status != MultivariateBatchDetectionStatus.Failed)
{
System.Threading.Thread.Sleep(1000);
resultResponse = client.GetMultivariateBatchDetectionResultValue(result_id);
Expand All @@ -120,7 +120,7 @@ private MultivariateDetectionResult BatchDetect(AnomalyDetectorClient client, st
Console.Out.Flush();
}

if (result_status == MultivariateDetectionStatus.Failed)
if (result_status == MultivariateBatchDetectionStatus.Failed)
{
Console.WriteLine("Detection failed.");
Console.WriteLine("Errors:");
Expand Down
Loading

0 comments on commit 3bc773a

Please sign in to comment.