System Information (please complete the following information):
OS & Version: Windows 11
ML.NET Version: 1.7.1 and 2.0.0-preview.22313.1
.NET Version: .NET 6.0
Describe the bug
When fitting the ForecastBySsa model with certain data sets a System.ArithmeticException is thrown with the message 'Function does not accept floating point Not-a-Number values.'. The call stack is:
at System.Math.Sign(Double value)
at Microsoft.ML.Transforms.TimeSeries.TrajectoryMatrix.FftMultiplyTranspose(Single[] vector, Single[] result, Boolean add, Int32 srcIndex, Int32 dstIndex)
at Microsoft.ML.Transforms.TimeSeries.AdaptiveSingularSpectrumSequenceModelerInternal.ComputeNoiseMoments(Single[] series, Single[] signal, Single[] alpha, Single& observationNoiseVariance, Single& autoregressionNoiseVariance, Single& observationNoiseMean, Single& autoregressionNoiseMean, Int32 startIndex)
at Microsoft.ML.Transforms.TimeSeries.AdaptiveSingularSpectrumSequenceModelerInternal.TrainCore(Single[] dataArray, Int32 originalSeriesLength)
at Microsoft.ML.Transforms.TimeSeries.AdaptiveSingularSpectrumSequenceModelerInternal.Train(RoleMappedData data)
at Microsoft.ML.Transforms.TimeSeries.SsaForecastingEstimator.Fit(IDataView input)
at TestProject.ValuePredictor.Predict(IList`1 window, DataPointStats stats)
To Reproduce
Run this code to reproduce the error:
using Microsoft.ML;
using Microsoft.ML.Transforms.TimeSeries;
using System.Collections.Generic;
using System.Linq;
record TrainingData(float Value);
record OutputData(float Value, float Value_LB, float Value_UB);
var data = new[] { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,11 };
var context = new MLContext(seed: 0);
var trainingData = context.Data.LoadFromEnumerable(data.Select(x => new TrainingData(x)));
var pipeline = context.Forecasting.ForecastBySsa(
windowSize: 28,
seriesLength: data.Length * 2,
trainSize: data.Length,
horizon: 1,
outputColumnName: nameof(OutputData.Value),
inputColumnName: nameof(TrainingData.Value),
confidenceLowerBoundColumn: nameof(OutputData.Value_LB),
confidenceUpperBoundColumn: nameof(OutputData.Value_UB));
var model = pipeline.Fit(trainingData);
Expected behavior
No error should occur when fitting the data.
System Information (please complete the following information):
Describe the bug When fitting the ForecastBySsa model with certain data sets a
System.ArithmeticException
is thrown with the message 'Function does not accept floating point Not-a-Number values.'. The call stack is:To Reproduce Run this code to reproduce the error:
Expected behavior No error should occur when fitting the data.
Screenshots, Code, Sample Projects This is a .NET interactive notebook with the repro code set up and ready to run: Fitting ForecastBySsa ArithmeticException repro.zip
Additional context