Skip to content

Commit 816479a

Browse files
refine
1 parent c3f74d5 commit 816479a

File tree

6 files changed

+13
-14
lines changed

6 files changed

+13
-14
lines changed

src/Microsoft.ML.TimeSeries/STL/FastLoess.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ internal class FastLoess
1414
/// </summary>
1515
private const int _sampleSize = 100;
1616

17+
/// <summary>
18+
/// The minimum length of a valid time series. A time series with length equals 2 is so trivial and meaningless less than 2.
19+
/// </summary>
20+
public const int MinTimeSeriesLength = 3;
21+
1722
private readonly IReadOnlyList<double> _x;
1823
private readonly IReadOnlyList<double> _y;
1924
private readonly int _length;
@@ -35,7 +40,7 @@ public FastLoess(IReadOnlyList<double> xValues, IReadOnlyList<double> yValues, b
3540
Contracts.CheckValue(yValues, nameof(yValues));
3641
Y = new List<double>();
3742

38-
if (yValues.Count < LoessBasicParameters.MinTimeSeriesLength)
43+
if (yValues.Count < MinTimeSeriesLength)
3944
throw Contracts.Except("input data structure cannot be 0-length: lowess");
4045

4146
_x = xValues;

src/Microsoft.ML.TimeSeries/STL/LeastSquares.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public AbstractPolynomialModel RegressionDegreeOneWeighted(IReadOnlyList<double>
4343

4444
Contracts.CheckParam(weights.Count == _length, nameof(weights));
4545
if (weights.Count != _length)
46-
throw Contracts.Except("the weight vector is not equal length to the data points");
46+
throw Contracts.Except("The length of the weight vector is not equal to the length of the data points.");
4747

4848
// This part unfolds the matrix calculation of [sqrt(W), sqrt(W) .* X]^T * [sqrt(W), sqrt(W) .* X]
4949
double sum00 = 0;

src/Microsoft.ML.TimeSeries/STL/Loess.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ namespace Microsoft.ML.TimeSeries
99
/// </summary>
1010
internal class Loess
1111
{
12+
/// <summary>
13+
/// The minimum length of a valid time series. A time series with length equals 2 is so trivial and meaningless less than 2.
14+
/// </summary>
15+
public const int MinTimeSeriesLength = 3;
1216

1317
private const double NumericalThreshold = 1.0e-10;
1418

@@ -41,7 +45,7 @@ public Loess(IReadOnlyList<double> xValues, IReadOnlyList<double> yValues, bool
4145
Contracts.CheckValue(xValues, nameof(xValues));
4246
Contracts.CheckValue(yValues, nameof(yValues));
4347

44-
if (xValues.Count < LoessBasicParameters.MinTimeSeriesLength || yValues.Count < LoessBasicParameters.MinTimeSeriesLength)
48+
if (xValues.Count < MinTimeSeriesLength || yValues.Count < MinTimeSeriesLength)
4549
throw Contracts.Except("input data structure cannot be 0-length: lowess");
4650

4751
if (xValues.Count != yValues.Count)

src/Microsoft.ML.TimeSeries/STL/LoessBasicParameters.cs

Lines changed: 0 additions & 10 deletions
This file was deleted.

src/Microsoft.ML.TimeSeries/SrCnnEntireAnomalyDetector.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ public SrCnnEntireAnomalyDetector(IHostEnvironment env, IDataView input, string
202202

203203
private void CheckOptionArguments(SrCnnEntireAnomalyDetectorOptions options)
204204
{
205-
Host.CheckUserArg(options.Period >= 0, nameof(options.Period), "Must be integer equal or greater than 0.");
205+
Host.CheckUserArg(options.Period >= 0, nameof(options.Period), "Must be an integer equal to or greater than 0.");
206206

207207
Host.CheckUserArg(options.BatchSize == -1 || options.BatchSize >= MinBatchSize, nameof(options.BatchSize), "Must be -1 or no less than 12.");
208208
Host.CheckUserArg(options.BatchSize >= 4 * options.Period || options.BatchSize == -1 || options.Period == 0, nameof(options.BatchSize), "Must be at least four times the length of one period.");

0 commit comments

Comments
 (0)