为什么 ReadFromEnumerable 方法不起作用? ML.NET
Why is the ReadFromEnumerable method not working? ML.NET
我正在尝试重新创建以下示例 https://github.com/dotnet/machinelearning/blob/master/docs/samples/Microsoft.ML.Samples/Dynamic/SsaSpikeDetectorTransform.cs
但我不断收到错误消息,指出 DataOperations 不包含 ReadFromEnumerable 方法的定义。
我还收到 CreateEnumerable 方法不存在的错误,但我怀疑它与 ReadFromEnumerable 错误有关。
我复制了整个命名空间和代码以防遗漏某些内容,但错误仍然存在。
从枚举方法读取
var ml = new MLContext();
//Generate sample series data with a recurring pattern and a spike within the pattern
const int SeasonalitySize = 5;
const int TrainingSeasons = 3;
const int TrainingSize = SeasonalitySize * TrainingSeasons;
var data = new List<SsaSpikeData>();
for (int i = 0; i < TrainingSeasons; i++)
for (int j = 0; j < SeasonalitySize; j++)
data.Add(new SsaSpikeData(j));
//This is a spike
data.Add(new SsaSpikeData(100));
for (int i = 0; i < SeasonalitySize; i++)
data.Add(new SsaSpikeData(i));
// Convert data to IDataView.
var dataView = ml.Data.ReadFromEnumerable(data); //This is where the error occurs
创建枚举方法
var predictionColumn = ml.CreateEnumerable<SsaSpikePrediction>(transformedData, reuseRowObject: false);
正如dlatikay所说,是版本不匹配。
我提供的示例来自仍处于预览状态的版本。
对于 ML.NET 0.9.0 及更早版本,您需要使用 CreateStreamingDataView。
要使 ReadFromEnumerable 和 CreateEnumerable 正常工作,您可以从此处 https://dotnet.myget.org/feed/dotnet-core/package/nuget/Microsoft.ML/0.11.0-preview-27404-5
下载 ML.NET 0.10.0 和 0.11.0 预览包
我正在尝试重新创建以下示例 https://github.com/dotnet/machinelearning/blob/master/docs/samples/Microsoft.ML.Samples/Dynamic/SsaSpikeDetectorTransform.cs 但我不断收到错误消息,指出 DataOperations 不包含 ReadFromEnumerable 方法的定义。 我还收到 CreateEnumerable 方法不存在的错误,但我怀疑它与 ReadFromEnumerable 错误有关。
我复制了整个命名空间和代码以防遗漏某些内容,但错误仍然存在。
从枚举方法读取
var ml = new MLContext();
//Generate sample series data with a recurring pattern and a spike within the pattern
const int SeasonalitySize = 5;
const int TrainingSeasons = 3;
const int TrainingSize = SeasonalitySize * TrainingSeasons;
var data = new List<SsaSpikeData>();
for (int i = 0; i < TrainingSeasons; i++)
for (int j = 0; j < SeasonalitySize; j++)
data.Add(new SsaSpikeData(j));
//This is a spike
data.Add(new SsaSpikeData(100));
for (int i = 0; i < SeasonalitySize; i++)
data.Add(new SsaSpikeData(i));
// Convert data to IDataView.
var dataView = ml.Data.ReadFromEnumerable(data); //This is where the error occurs
创建枚举方法
var predictionColumn = ml.CreateEnumerable<SsaSpikePrediction>(transformedData, reuseRowObject: false);
正如dlatikay所说,是版本不匹配。 我提供的示例来自仍处于预览状态的版本。 对于 ML.NET 0.9.0 及更早版本,您需要使用 CreateStreamingDataView。 要使 ReadFromEnumerable 和 CreateEnumerable 正常工作,您可以从此处 https://dotnet.myget.org/feed/dotnet-core/package/nuget/Microsoft.ML/0.11.0-preview-27404-5
下载 ML.NET 0.10.0 和 0.11.0 预览包