From 75e5d3d1f9bad4623216223c9442db4ac61357b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrej=20Kmet=C3=ADk?= Date: Sat, 13 Feb 2021 15:06:05 +0100 Subject: [PATCH 1/3] TimeSeries - fix confidence parameter type for some detectors. - The public API exposed confidence parameters as int even though it's internally implemented as double - There was no workaround since all classes where double is used are internal - This caused major issues for software requiring high precision predictions - This change to API should be backwards compatible since int can be passed to parameter of type double --- src/Microsoft.ML.TimeSeries/ExtensionsCatalog.cs | 8 ++++---- src/Microsoft.ML.TimeSeries/IidChangePointDetector.cs | 4 ++-- src/Microsoft.ML.TimeSeries/IidSpikeDetector.cs | 4 ++-- src/Microsoft.ML.TimeSeries/SsaChangePointDetector.cs | 4 ++-- src/Microsoft.ML.TimeSeries/SsaSpikeDetector.cs | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Microsoft.ML.TimeSeries/ExtensionsCatalog.cs b/src/Microsoft.ML.TimeSeries/ExtensionsCatalog.cs index d4b49322dd..3e050af683 100644 --- a/src/Microsoft.ML.TimeSeries/ExtensionsCatalog.cs +++ b/src/Microsoft.ML.TimeSeries/ExtensionsCatalog.cs @@ -33,7 +33,7 @@ public static class TimeSeriesCatalog /// /// public static IidChangePointEstimator DetectIidChangePoint(this TransformsCatalog catalog, string outputColumnName, string inputColumnName, - int confidence, int changeHistoryLength, MartingaleType martingale = MartingaleType.Power, double eps = 0.1) + double confidence, int changeHistoryLength, MartingaleType martingale = MartingaleType.Power, double eps = 0.1) => new IidChangePointEstimator(CatalogUtils.GetEnvironment(catalog), outputColumnName, confidence, changeHistoryLength, inputColumnName, martingale, eps); /// @@ -57,7 +57,7 @@ public static IidChangePointEstimator DetectIidChangePoint(this TransformsCatalo /// /// public static IidSpikeEstimator DetectIidSpike(this TransformsCatalog catalog, string outputColumnName, string inputColumnName, - int confidence, int pvalueHistoryLength, AnomalySide side = AnomalySide.TwoSided) + double confidence, int pvalueHistoryLength, AnomalySide side = AnomalySide.TwoSided) => new IidSpikeEstimator(CatalogUtils.GetEnvironment(catalog), outputColumnName, confidence, pvalueHistoryLength, inputColumnName, side); /// @@ -84,7 +84,7 @@ public static IidSpikeEstimator DetectIidSpike(this TransformsCatalog catalog, s /// /// public static SsaChangePointEstimator DetectChangePointBySsa(this TransformsCatalog catalog, string outputColumnName, string inputColumnName, - int confidence, int changeHistoryLength, int trainingWindowSize, int seasonalityWindowSize, ErrorFunction errorFunction = ErrorFunction.SignedDifference, + double confidence, int changeHistoryLength, int trainingWindowSize, int seasonalityWindowSize, ErrorFunction errorFunction = ErrorFunction.SignedDifference, MartingaleType martingale = MartingaleType.Power, double eps = 0.1) => new SsaChangePointEstimator(CatalogUtils.GetEnvironment(catalog), new SsaChangePointDetector.Options { @@ -121,7 +121,7 @@ public static SsaChangePointEstimator DetectChangePointBySsa(this TransformsCata /// ]]> /// /// - public static SsaSpikeEstimator DetectSpikeBySsa(this TransformsCatalog catalog, string outputColumnName, string inputColumnName, int confidence, int pvalueHistoryLength, + public static SsaSpikeEstimator DetectSpikeBySsa(this TransformsCatalog catalog, string outputColumnName, string inputColumnName, double confidence, int pvalueHistoryLength, int trainingWindowSize, int seasonalityWindowSize, AnomalySide side = AnomalySide.TwoSided, ErrorFunction errorFunction = ErrorFunction.SignedDifference) => new SsaSpikeEstimator(CatalogUtils.GetEnvironment(catalog), outputColumnName, confidence, pvalueHistoryLength, trainingWindowSize, seasonalityWindowSize, inputColumnName, side, errorFunction); diff --git a/src/Microsoft.ML.TimeSeries/IidChangePointDetector.cs b/src/Microsoft.ML.TimeSeries/IidChangePointDetector.cs index 3ac2348f74..dbfdc32376 100644 --- a/src/Microsoft.ML.TimeSeries/IidChangePointDetector.cs +++ b/src/Microsoft.ML.TimeSeries/IidChangePointDetector.cs @@ -219,7 +219,7 @@ private static IRowMapper Create(IHostEnvironment env, ModelLoadContext ctx, Dat /// ]]> /// /// - /// + /// public sealed class IidChangePointEstimator : TrivialEstimator { /// @@ -233,7 +233,7 @@ public sealed class IidChangePointEstimator : TrivialEstimatorName of column to transform. If set to , the value of the will be used as source. /// The martingale used for scoring. /// The epsilon parameter for the Power martingale. - internal IidChangePointEstimator(IHostEnvironment env, string outputColumnName, int confidence, + internal IidChangePointEstimator(IHostEnvironment env, string outputColumnName, double confidence, int changeHistoryLength, string inputColumnName, MartingaleType martingale = MartingaleType.Power, double eps = 0.1) : base(Contracts.CheckRef(env, nameof(env)).Register(nameof(IidChangePointEstimator)), new IidChangePointDetector(env, new IidChangePointDetector.Options diff --git a/src/Microsoft.ML.TimeSeries/IidSpikeDetector.cs b/src/Microsoft.ML.TimeSeries/IidSpikeDetector.cs index e878db941a..0708aef2e8 100644 --- a/src/Microsoft.ML.TimeSeries/IidSpikeDetector.cs +++ b/src/Microsoft.ML.TimeSeries/IidSpikeDetector.cs @@ -199,7 +199,7 @@ private static IRowMapper Create(IHostEnvironment env, ModelLoadContext ctx, Dat /// ]]> /// /// - /// + /// public sealed class IidSpikeEstimator : TrivialEstimator { /// @@ -212,7 +212,7 @@ public sealed class IidSpikeEstimator : TrivialEstimator /// The size of the sliding window for computing the p-value. /// Name of column to transform. If set to , the value of the will be used as source. /// The argument that determines whether to detect positive or negative anomalies, or both. - internal IidSpikeEstimator(IHostEnvironment env, string outputColumnName, int confidence, int pvalueHistoryLength, string inputColumnName, AnomalySide side = AnomalySide.TwoSided) + internal IidSpikeEstimator(IHostEnvironment env, string outputColumnName, double confidence, int pvalueHistoryLength, string inputColumnName, AnomalySide side = AnomalySide.TwoSided) : base(Contracts.CheckRef(env, nameof(env)).Register(nameof(IidSpikeDetector)), new IidSpikeDetector(env, new IidSpikeDetector.Options { diff --git a/src/Microsoft.ML.TimeSeries/SsaChangePointDetector.cs b/src/Microsoft.ML.TimeSeries/SsaChangePointDetector.cs index 8d2018daed..1e3969b6a2 100644 --- a/src/Microsoft.ML.TimeSeries/SsaChangePointDetector.cs +++ b/src/Microsoft.ML.TimeSeries/SsaChangePointDetector.cs @@ -226,7 +226,7 @@ private static IRowMapper Create(IHostEnvironment env, ModelLoadContext ctx, Dat /// ]]> /// /// - /// + /// public sealed class SsaChangePointEstimator : IEstimator { private readonly IHost _host; @@ -247,7 +247,7 @@ public sealed class SsaChangePointEstimator : IEstimator /// The martingale used for scoring. /// The epsilon parameter for the Power martingale. internal SsaChangePointEstimator(IHostEnvironment env, string outputColumnName, - int confidence, + double confidence, int changeHistoryLength, int trainingWindowSize, int seasonalityWindowSize, diff --git a/src/Microsoft.ML.TimeSeries/SsaSpikeDetector.cs b/src/Microsoft.ML.TimeSeries/SsaSpikeDetector.cs index e22f80969e..a0e1fca547 100644 --- a/src/Microsoft.ML.TimeSeries/SsaSpikeDetector.cs +++ b/src/Microsoft.ML.TimeSeries/SsaSpikeDetector.cs @@ -207,7 +207,7 @@ private static IRowMapper Create(IHostEnvironment env, ModelLoadContext ctx, Dat /// ]]> /// /// - /// + /// public sealed class SsaSpikeEstimator : IEstimator { private readonly IHost _host; @@ -228,7 +228,7 @@ public sealed class SsaSpikeEstimator : IEstimator /// The function used to compute the error between the expected and the observed value. internal SsaSpikeEstimator(IHostEnvironment env, string outputColumnName, - int confidence, + double confidence, int pvalueHistoryLength, int trainingWindowSize, int seasonalityWindowSize, From 26e248ab680b5cc04fd8d287da088f69461b0d44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrej=20Kmet=C3=ADk?= Date: Thu, 18 Feb 2021 00:09:11 +0100 Subject: [PATCH 2/3] TimeSeries - reintroduce original methods with confidence parameter of type int (to not break the API). --- .../ExtensionsCatalog.cs | 103 ++++++++++++++++++ 1 file changed, 103 insertions(+) diff --git a/src/Microsoft.ML.TimeSeries/ExtensionsCatalog.cs b/src/Microsoft.ML.TimeSeries/ExtensionsCatalog.cs index 3e050af683..297f30d2aa 100644 --- a/src/Microsoft.ML.TimeSeries/ExtensionsCatalog.cs +++ b/src/Microsoft.ML.TimeSeries/ExtensionsCatalog.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System; using System.Collections.Generic; using Microsoft.ML.Data; using Microsoft.ML.Runtime; @@ -12,6 +13,30 @@ namespace Microsoft.ML { public static class TimeSeriesCatalog { + /// + /// Create , which predicts change points in an + /// independent identically distributed (i.i.d.) + /// time series based on adaptive kernel density estimations and martingale scores. + /// + /// The transform's catalog. + /// Name of the column resulting from the transformation of . + /// The column data is a vector of . The vector contains 4 elements: alert (non-zero value means a change point), raw score, p-Value and martingale score. + /// Name of column to transform. The column data must be . If set to , the value of the will be used as source. + /// The confidence for change point detection in the range [0, 100]. + /// The length of the sliding window on p-values for computing the martingale score. + /// The martingale used for scoring. + /// The epsilon parameter for the Power martingale. + /// + /// + /// + /// + /// + public static IidChangePointEstimator DetectIidChangePoint(this TransformsCatalog catalog, string outputColumnName, string inputColumnName, + int confidence, int changeHistoryLength, MartingaleType martingale = MartingaleType.Power, double eps = 0.1) + => DetectIidChangePoint(catalog, outputColumnName, inputColumnName, (double)confidence, changeHistoryLength, martingale, eps); + /// /// Create , which predicts change points in an /// independent identically distributed (i.i.d.) @@ -36,6 +61,30 @@ public static IidChangePointEstimator DetectIidChangePoint(this TransformsCatalo double confidence, int changeHistoryLength, MartingaleType martingale = MartingaleType.Power, double eps = 0.1) => new IidChangePointEstimator(CatalogUtils.GetEnvironment(catalog), outputColumnName, confidence, changeHistoryLength, inputColumnName, martingale, eps); + /// + /// Create , which predicts spikes in + /// independent identically distributed (i.i.d.) + /// time series based on adaptive kernel density estimations and martingale scores. + /// + /// The transform's catalog. + /// Name of the column resulting from the transformation of . + /// The column data is a vector of . The vector contains 3 elements: alert (non-zero value means a spike), raw score, and p-value. + /// Name of column to transform. The column data must be . + /// If set to , the value of the will be used as source. + /// The confidence for spike detection in the range [0, 100]. + /// The size of the sliding window for computing the p-value. + /// The argument that determines whether to detect positive or negative anomalies, or both. + /// + /// + /// + /// + /// + public static IidSpikeEstimator DetectIidSpike(this TransformsCatalog catalog, string outputColumnName, string inputColumnName, + int confidence, int pvalueHistoryLength, AnomalySide side = AnomalySide.TwoSided) + => DetectIidSpike(catalog, outputColumnName, inputColumnName, (double)confidence, pvalueHistoryLength, side); + /// /// Create , which predicts spikes in /// independent identically distributed (i.i.d.) @@ -60,6 +109,34 @@ public static IidSpikeEstimator DetectIidSpike(this TransformsCatalog catalog, s double confidence, int pvalueHistoryLength, AnomalySide side = AnomalySide.TwoSided) => new IidSpikeEstimator(CatalogUtils.GetEnvironment(catalog), outputColumnName, confidence, pvalueHistoryLength, inputColumnName, side); + /// + /// Create , which predicts change points in time series + /// using Singular Spectrum Analysis (SSA). + /// + /// The transform's catalog. + /// Name of the column resulting from the transformation of . + /// The column data is a vector of . The vector contains 4 elements: alert (non-zero value means a change point), raw score, p-Value and martingale score. + /// Name of column to transform. The column data must be . + /// If set to , the value of the will be used as source. + /// The confidence for change point detection in the range [0, 100]. + /// The number of points from the beginning of the sequence used for training. + /// The size of the sliding window for computing the p-value. + /// An upper bound on the largest relevant seasonality in the input time-series. + /// The function used to compute the error between the expected and the observed value. + /// The martingale used for scoring. + /// The epsilon parameter for the Power martingale. + /// + /// + /// + /// + /// + public static SsaChangePointEstimator DetectChangePointBySsa(this TransformsCatalog catalog, string outputColumnName, string inputColumnName, + int confidence, int changeHistoryLength, int trainingWindowSize, int seasonalityWindowSize, ErrorFunction errorFunction = ErrorFunction.SignedDifference, + MartingaleType martingale = MartingaleType.Power, double eps = 0.1) + => DetectChangePointBySsa(catalog, outputColumnName, inputColumnName, (double)confidence, changeHistoryLength, trainingWindowSize, seasonalityWindowSize, errorFunction, martingale, eps); + /// /// Create , which predicts change points in time series /// using Singular Spectrum Analysis (SSA). @@ -99,6 +176,32 @@ public static SsaChangePointEstimator DetectChangePointBySsa(this TransformsCata ErrorFunction = errorFunction }); + /// + /// Create , which predicts spikes in time series + /// using Singular Spectrum Analysis (SSA). + /// + /// The transform's catalog. + /// Name of the column resulting from the transformation of . + /// The column data is a vector of . The vector contains 3 elements: alert (non-zero value means a spike), raw score, and p-value. + /// Name of column to transform. The column data must be . + /// If set to , the value of the will be used as source. + /// The confidence for spike detection in the range [0, 100]. + /// The size of the sliding window for computing the p-value. + /// The number of points from the beginning of the sequence used for training. + /// An upper bound on the largest relevant seasonality in the input time-series. + /// The argument that determines whether to detect positive or negative anomalies, or both. + /// The function used to compute the error between the expected and the observed value. + /// + /// + /// + /// + /// + public static SsaSpikeEstimator DetectSpikeBySsa(this TransformsCatalog catalog, string outputColumnName, string inputColumnName, int confidence, int pvalueHistoryLength, + int trainingWindowSize, int seasonalityWindowSize, AnomalySide side = AnomalySide.TwoSided, ErrorFunction errorFunction = ErrorFunction.SignedDifference) + => DetectSpikeBySsa(catalog, outputColumnName, inputColumnName, (double)confidence, pvalueHistoryLength, trainingWindowSize, seasonalityWindowSize, side, errorFunction); + /// /// Create , which predicts spikes in time series /// using Singular Spectrum Analysis (SSA). From 5819330d57d5d33e89ab11b1b4f53749774bee9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrej=20Kmet=C3=ADk?= Date: Thu, 18 Feb 2021 00:15:17 +0100 Subject: [PATCH 3/3] TimeSeries - make catalog API methods with int confidence parameter deprecated. - Tests adjusted to not use the deprecated methods --- .../Transforms/TimeSeries/DetectChangePointBySsa.cs | 2 +- .../TimeSeries/DetectChangePointBySsaBatchPrediction.cs | 2 +- .../Transforms/TimeSeries/DetectChangePointBySsaStream.cs | 2 +- .../Dynamic/Transforms/TimeSeries/DetectIidChangePoint.cs | 2 +- .../TimeSeries/DetectIidChangePointBatchPrediction.cs | 2 +- .../Dynamic/Transforms/TimeSeries/DetectIidSpike.cs | 2 +- .../TimeSeries/DetectIidSpikeBatchPrediction.cs | 2 +- .../Dynamic/Transforms/TimeSeries/DetectSpikeBySsa.cs | 2 +- .../TimeSeries/DetectSpikeBySsaBatchPrediction.cs | 2 +- src/Microsoft.ML.TimeSeries/ExtensionsCatalog.cs | 4 ++++ .../TimeSeriesSimpleApiTests.cs | 8 ++++---- 11 files changed, 17 insertions(+), 13 deletions(-) diff --git a/docs/samples/Microsoft.ML.Samples/Dynamic/Transforms/TimeSeries/DetectChangePointBySsa.cs b/docs/samples/Microsoft.ML.Samples/Dynamic/Transforms/TimeSeries/DetectChangePointBySsa.cs index 7d545770f9..23fb7e5c9c 100644 --- a/docs/samples/Microsoft.ML.Samples/Dynamic/Transforms/TimeSeries/DetectChangePointBySsa.cs +++ b/docs/samples/Microsoft.ML.Samples/Dynamic/Transforms/TimeSeries/DetectChangePointBySsa.cs @@ -52,7 +52,7 @@ public static void Example() // Setup SsaChangePointDetector arguments var inputColumnName = nameof(TimeSeriesData.Value); var outputColumnName = nameof(ChangePointPrediction.Prediction); - int confidence = 95; + double confidence = 95; int changeHistoryLength = 8; // Train the change point detector. diff --git a/docs/samples/Microsoft.ML.Samples/Dynamic/Transforms/TimeSeries/DetectChangePointBySsaBatchPrediction.cs b/docs/samples/Microsoft.ML.Samples/Dynamic/Transforms/TimeSeries/DetectChangePointBySsaBatchPrediction.cs index 25819052d8..85732f9259 100644 --- a/docs/samples/Microsoft.ML.Samples/Dynamic/Transforms/TimeSeries/DetectChangePointBySsaBatchPrediction.cs +++ b/docs/samples/Microsoft.ML.Samples/Dynamic/Transforms/TimeSeries/DetectChangePointBySsaBatchPrediction.cs @@ -59,7 +59,7 @@ public static void Example() // The transformed data. var transformedData = ml.Transforms.DetectChangePointBySsa( - outputColumnName, inputColumnName, 95, 8, TrainingSize, + outputColumnName, inputColumnName, 95.0d, 8, TrainingSize, SeasonalitySize + 1).Fit(dataView).Transform(dataView); // Getting the data of the newly created column as an IEnumerable of diff --git a/docs/samples/Microsoft.ML.Samples/Dynamic/Transforms/TimeSeries/DetectChangePointBySsaStream.cs b/docs/samples/Microsoft.ML.Samples/Dynamic/Transforms/TimeSeries/DetectChangePointBySsaStream.cs index c65d3af987..dfab85aee2 100644 --- a/docs/samples/Microsoft.ML.Samples/Dynamic/Transforms/TimeSeries/DetectChangePointBySsaStream.cs +++ b/docs/samples/Microsoft.ML.Samples/Dynamic/Transforms/TimeSeries/DetectChangePointBySsaStream.cs @@ -52,7 +52,7 @@ public static void Example() // Setup SsaChangePointDetector arguments var inputColumnName = nameof(TimeSeriesData.Value); var outputColumnName = nameof(ChangePointPrediction.Prediction); - int confidence = 95; + double confidence = 95; int changeHistoryLength = 8; // Train the change point detector. diff --git a/docs/samples/Microsoft.ML.Samples/Dynamic/Transforms/TimeSeries/DetectIidChangePoint.cs b/docs/samples/Microsoft.ML.Samples/Dynamic/Transforms/TimeSeries/DetectIidChangePoint.cs index 4e44a73607..852fc9f8e9 100644 --- a/docs/samples/Microsoft.ML.Samples/Dynamic/Transforms/TimeSeries/DetectIidChangePoint.cs +++ b/docs/samples/Microsoft.ML.Samples/Dynamic/Transforms/TimeSeries/DetectIidChangePoint.cs @@ -55,7 +55,7 @@ public static void Example() // Time Series model. ITransformer model = ml.Transforms.DetectIidChangePoint( - outputColumnName, inputColumnName, 95, Size / 4).Fit(dataView); + outputColumnName, inputColumnName, 95.0d, Size / 4).Fit(dataView); // Create a time series prediction engine from the model. var engine = model.CreateTimeSeriesEngine /// /// + [Obsolete("This API method is deprecated, please use the overload with confidence parameter of type double.")] public static IidChangePointEstimator DetectIidChangePoint(this TransformsCatalog catalog, string outputColumnName, string inputColumnName, int confidence, int changeHistoryLength, MartingaleType martingale = MartingaleType.Power, double eps = 0.1) => DetectIidChangePoint(catalog, outputColumnName, inputColumnName, (double)confidence, changeHistoryLength, martingale, eps); @@ -81,6 +82,7 @@ public static IidChangePointEstimator DetectIidChangePoint(this TransformsCatalo /// ]]> /// /// + [Obsolete("This API method is deprecated, please use the overload with confidence parameter of type double.")] public static IidSpikeEstimator DetectIidSpike(this TransformsCatalog catalog, string outputColumnName, string inputColumnName, int confidence, int pvalueHistoryLength, AnomalySide side = AnomalySide.TwoSided) => DetectIidSpike(catalog, outputColumnName, inputColumnName, (double)confidence, pvalueHistoryLength, side); @@ -132,6 +134,7 @@ public static IidSpikeEstimator DetectIidSpike(this TransformsCatalog catalog, s /// ]]> /// /// + [Obsolete("This API method is deprecated, please use the overload with confidence parameter of type double.")] public static SsaChangePointEstimator DetectChangePointBySsa(this TransformsCatalog catalog, string outputColumnName, string inputColumnName, int confidence, int changeHistoryLength, int trainingWindowSize, int seasonalityWindowSize, ErrorFunction errorFunction = ErrorFunction.SignedDifference, MartingaleType martingale = MartingaleType.Power, double eps = 0.1) @@ -198,6 +201,7 @@ public static SsaChangePointEstimator DetectChangePointBySsa(this TransformsCata /// ]]> /// /// + [Obsolete("This API method is deprecated, please use the overload with confidence parameter of type double.")] public static SsaSpikeEstimator DetectSpikeBySsa(this TransformsCatalog catalog, string outputColumnName, string inputColumnName, int confidence, int pvalueHistoryLength, int trainingWindowSize, int seasonalityWindowSize, AnomalySide side = AnomalySide.TwoSided, ErrorFunction errorFunction = ErrorFunction.SignedDifference) => DetectSpikeBySsa(catalog, outputColumnName, inputColumnName, (double)confidence, pvalueHistoryLength, trainingWindowSize, seasonalityWindowSize, side, errorFunction); diff --git a/test/Microsoft.ML.TimeSeries.Tests/TimeSeriesSimpleApiTests.cs b/test/Microsoft.ML.TimeSeries.Tests/TimeSeriesSimpleApiTests.cs index aad10ccef2..7905bf6d89 100644 --- a/test/Microsoft.ML.TimeSeries.Tests/TimeSeriesSimpleApiTests.cs +++ b/test/Microsoft.ML.TimeSeries.Tests/TimeSeriesSimpleApiTests.cs @@ -48,7 +48,7 @@ public void ChangeDetection() data.Add(new Data((float)(5 + i * 1.1))); // Build the pipeline - var learningPipeline = ML.Transforms.DetectIidChangePoint("Data", "Value", 80, size); + var learningPipeline = ML.Transforms.DetectIidChangePoint("Data", "Value", 80.0d, size); // Train var detector = learningPipeline.Fit(dataView); @@ -92,7 +92,7 @@ public void ChangePointDetectionWithSeasonality() data.Add(new Data(i * 100)); // Build the pipeline - var learningPipeline = ML.Transforms.DetectChangePointBySsa("Data", "Value", 95, changeHistorySize, maxTrainingSize, seasonalitySize); + var learningPipeline = ML.Transforms.DetectChangePointBySsa("Data", "Value", 95.0d, changeHistorySize, maxTrainingSize, seasonalitySize); // Train var detector = learningPipeline.Fit(dataView); // Transform @@ -133,7 +133,7 @@ public void SpikeDetection() data.Add(new Data(5)); // Build the pipeline - var learningPipeline = ML.Transforms.DetectIidSpike("Data", "Value", 80, pvalHistoryLength); + var learningPipeline = ML.Transforms.DetectIidSpike("Data", "Value", 80.0d, pvalHistoryLength); // Train var detector = learningPipeline.Fit(dataView); // Transform @@ -185,7 +185,7 @@ public void SsaSpikeDetection() data.Add(new Data(5)); // Build the pipeline - var learningPipeline = ML.Transforms.DetectSpikeBySsa("Data", "Value", 80, changeHistoryLength, trainingWindowSize, seasonalityWindowSize); + var learningPipeline = ML.Transforms.DetectSpikeBySsa("Data", "Value", 80.0d, changeHistoryLength, trainingWindowSize, seasonalityWindowSize); // Train var detector = learningPipeline.Fit(dataView); // Transform