使用 C# 的异常检测器

Anomaly detector with C#

我将异常检测器与 .NET 5 和代码一起使用 here

Main 方法的签名应该是什么?目前是

public  async Task Main(string[] args)

我收到这些错误消息:

can't convert type void to system.guid

Severity Code Description Project File Line Suppression State Error CS1997 Since 'Program.trainAsync(AnomalyDetectorClient, string, DateTimeOffset, DateTimeOffset, int)' is an async method that returns 'Task', a return keyword must not be followed by an object expression. Did you intend to return 'Task'? anomaly-detector-quickstart-multivariate C:\CognitiveSvs\Anomalies\anomaly-detector-quickstart-multivariate\Program.cs 116 Active

另外,还有一个语句using Azure.Core.TestFramework;这似乎不存在。我应该用什么代替它?

是否有可用于单变量和多变量分析的示例数据?

我认为 example 代码不正确(或显示不正确)。

错误与 Main 方法无关,而与 trainAsync 方法有关。

CS1997 Since 'Program.trainAsync(AnomalyDetectorClient, string, DateTimeOffset, DateTimeOffset, int)' is an async method that returns 'Task', a return keyword must not be followed by an object expression. Did you intend to return 'Task'? anomaly-detector-quickstart-multivariate C:\CognitiveSvs\Anomalies\anomaly-detector-quickstart-multivariate\Program.cs 116

在你的link中描述如下:

private async Task trainAsync(AnomalyDetectorClient client, string datasource, DateTimeOffset start_time, DateTimeOffset end_time, int max_tryout = 500)
{
...

根据您收到的错误消息,以及文档的 source 和方法的实际代码(returns 和 Guid),这是正确的签名trainAsync 方法:

private async Task<Guid?> trainAsync(AnomalyDetectorClient client, string datasource, DateTimeOffset start_time, DateTimeOffset end_time, int max_tryout = 500)
{
...