Skip to content

Commit 7f34287

Browse files
authored
Fix typo in time series forecasting API. (dotnet#3944)
* Fix typo in time series forecasting API. * manifest.
1 parent f67aab5 commit 7f34287

File tree

8 files changed

+47
-47
lines changed

8 files changed

+47
-47
lines changed

docs/samples/Microsoft.ML.Samples/Dynamic/Transforms/TimeSeries/ForecastingWithConfidenceInterval.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ public static void Example()
4848
// Instantiate the forecasting model.
4949
var model = ml.Forecasting.ForecastBySsa(outputColumnName, inputColumnName, 5, 11, data.Count, 5,
5050
confidenceLevel: 0.95f,
51-
forcastingConfidentLowerBoundColumnName: "ConfidenceLowerBound",
52-
forcastingConfidentUpperBoundColumnName: "ConfidenceUpperBound");
51+
lowerBoundConfidenceColumn: "ConfidenceLowerBound",
52+
upperBoundConfidenceColumn: "ConfidenceUpperBound");
5353

5454
// Train.
5555
var transformer = model.Fit(dataView);

src/Microsoft.ML.TimeSeries/ExtensionsCatalog.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -164,11 +164,11 @@ public static SrCnnAnomalyEstimator DetectAnomalyBySrCnn(this TransformsCatalog
164164
/// <param name="rank">The desired rank of the subspace used for SSA projection (parameter r). This parameter should be in the range in [1, windowSize].
165165
/// If set to null, the rank is automatically determined based on prediction error minimization.</param>
166166
/// <param name="maxRank">The maximum rank considered during the rank selection process. If not provided (i.e. set to null), it is set to windowSize - 1.</param>
167-
/// <param name="shouldStablize">The flag determining whether the model should be stabilized.</param>
167+
/// <param name="shouldStabilize">The flag determining whether the model should be stabilized.</param>
168168
/// <param name="shouldMaintainInfo">The flag determining whether the meta information for the model needs to be maintained.</param>
169169
/// <param name="maxGrowth">The maximum growth on the exponential trend.</param>
170-
/// <param name="forcastingConfidentLowerBoundColumnName">The name of the confidence interval lower bound column. If not specified then confidence intervals will not be calculated.</param>
171-
/// <param name="forcastingConfidentUpperBoundColumnName">The name of the confidence interval upper bound column. If not specified then confidence intervals will not be calculated.</param>
170+
/// <param name="lowerBoundConfidenceColumn">The name of the confidence interval lower bound column. If not specified then confidence intervals will not be calculated.</param>
171+
/// <param name="upperBoundConfidenceColumn">The name of the confidence interval upper bound column. If not specified then confidence intervals will not be calculated.</param>
172172
/// <param name="confidenceLevel">The confidence level for forecasting.</param>
173173
/// <param name="variableHorizon">Set this to true if horizon will change after training(at prediction time).</param>
174174
/// <example>
@@ -182,10 +182,10 @@ public static SrCnnAnomalyEstimator DetectAnomalyBySrCnn(this TransformsCatalog
182182
public static SsaForecastingEstimator ForecastBySsa(
183183
this ForecastingCatalog catalog, string outputColumnName, string inputColumnName, int windowSize, int seriesLength, int trainSize, int horizon,
184184
bool isAdaptive = false, float discountFactor = 1, RankSelectionMethod rankSelectionMethod = RankSelectionMethod.Exact, int? rank = null,
185-
int? maxRank = null, bool shouldStablize = true, bool shouldMaintainInfo = false, GrowthRatio? maxGrowth = null, string forcastingConfidentLowerBoundColumnName = null,
186-
string forcastingConfidentUpperBoundColumnName = null, float confidenceLevel = 0.95f, bool variableHorizon = false) =>
185+
int? maxRank = null, bool shouldStabilize = true, bool shouldMaintainInfo = false, GrowthRatio? maxGrowth = null, string lowerBoundConfidenceColumn = null,
186+
string upperBoundConfidenceColumn = null, float confidenceLevel = 0.95f, bool variableHorizon = false) =>
187187
new SsaForecastingEstimator(CatalogUtils.GetEnvironment(catalog), outputColumnName, inputColumnName, windowSize, seriesLength, trainSize,
188-
horizon, isAdaptive, discountFactor, rankSelectionMethod, rank, maxRank, shouldStablize, shouldMaintainInfo, maxGrowth, forcastingConfidentLowerBoundColumnName,
189-
forcastingConfidentUpperBoundColumnName, confidenceLevel, variableHorizon);
188+
horizon, isAdaptive, discountFactor, rankSelectionMethod, rank, maxRank, shouldStabilize, shouldMaintainInfo, maxGrowth, lowerBoundConfidenceColumn,
189+
upperBoundConfidenceColumn, confidenceLevel, variableHorizon);
190190
}
191191
}

src/Microsoft.ML.TimeSeries/SSaForecasting.cs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ internal sealed class Options : TransformInputBase
4242
public string Name;
4343

4444
[Argument(ArgumentType.AtMostOnce, HelpText = "The name of the confidence interval lower bound column.", ShortName = "cnfminname", SortOrder = 3)]
45-
public string ForcastingConfidentLowerBoundColumnName;
45+
public string LowerBoundConfidenceColumn;
4646

4747
[Argument(ArgumentType.AtMostOnce, HelpText = "The name of the confidence interval upper bound column.", ShortName = "cnfmaxnname", SortOrder = 3)]
48-
public string ForcastingConfidentUpperBoundColumnName;
48+
public string UpperBoundConfidenceColumn;
4949

5050
[Argument(ArgumentType.AtMostOnce, HelpText = "The discount factor in [0,1] used for online updates.", ShortName = "disc", SortOrder = 5)]
5151
public float DiscountFactor = 1;
@@ -67,7 +67,7 @@ internal sealed class Options : TransformInputBase
6767
public int? MaxRank = null;
6868

6969
[Argument(ArgumentType.AtMostOnce, HelpText = "The flag determining whether the model should be stabilized.", SortOrder = 3)]
70-
public bool ShouldStablize = true;
70+
public bool ShouldStabilize = true;
7171

7272
[Argument(ArgumentType.AtMostOnce, HelpText = "The flag determining whether the meta information for the model needs to be maintained.", SortOrder = 3)]
7373
public bool ShouldMaintainInfo = false;
@@ -97,14 +97,14 @@ public BaseArguments(Options options)
9797
{
9898
Source = options.Source;
9999
Name = options.Name;
100-
ForcastingConfidentLowerBoundColumnName = options.ForcastingConfidentLowerBoundColumnName;
101-
ForcastingConfidentUpperBoundColumnName = options.ForcastingConfidentUpperBoundColumnName;
100+
LowerBoundConfidenceColumn = options.LowerBoundConfidenceColumn;
101+
UpperBoundConfidenceColumn = options.UpperBoundConfidenceColumn;
102102
WindowSize = options.WindowSize;
103103
DiscountFactor = options.DiscountFactor;
104104
IsAdaptive = options.IsAdaptive;
105105
RankSelectionMethod = options.RankSelectionMethod;
106106
Rank = options.Rank;
107-
ShouldStablize = options.ShouldStablize;
107+
ShouldStablize = options.ShouldStabilize;
108108
MaxGrowth = options.MaxGrowth;
109109
SeriesLength = options.SeriesLength;
110110
TrainSize = options.TrainSize;
@@ -255,11 +255,11 @@ public sealed class SsaForecastingEstimator : IEstimator<SsaForecastingTransform
255255
/// <param name="rank">The desired rank of the subspace used for SSA projection (parameter r). This parameter should be in the range in [1, windowSize].
256256
/// If set to null, the rank is automatically determined based on prediction error minimization.</param>
257257
/// <param name="maxRank">The maximum rank considered during the rank selection process. If not provided (i.e. set to null), it is set to windowSize - 1.</param>
258-
/// <param name="shouldStablize">The flag determining whether the model should be stabilized.</param>
258+
/// <param name="shouldStabilize">The flag determining whether the model should be stabilized.</param>
259259
/// <param name="shouldMaintainInfo">The flag determining whether the meta information for the model needs to be maintained.</param>
260260
/// <param name="maxGrowth">The maximum growth on the exponential trend.</param>
261-
/// <param name="forcastingConfidentLowerBoundColumnName">The name of the confidence interval lower bound column. If not specified then confidence intervals will not be calculated.</param>
262-
/// <param name="forcastingConfidentUpperBoundColumnName">The name of the confidence interval upper bound column. If not specified then confidence intervals will not be calculated.</param>
261+
/// <param name="lowerBoundConfidenceColumn">The name of the confidence interval lower bound column. If not specified then confidence intervals will not be calculated.</param>
262+
/// <param name="upperBoundConfidenceColumn">The name of the confidence interval upper bound column. If not specified then confidence intervals will not be calculated.</param>
263263
/// <param name="confidenceLevel">The confidence level for forecasting.</param>
264264
/// <param name="variableHorizon">Set this to true if horizon will change after training.</param>
265265
internal SsaForecastingEstimator(IHostEnvironment env,
@@ -274,11 +274,11 @@ internal SsaForecastingEstimator(IHostEnvironment env,
274274
RankSelectionMethod rankSelectionMethod = RankSelectionMethod.Exact,
275275
int? rank = null,
276276
int? maxRank = null,
277-
bool shouldStablize = true,
277+
bool shouldStabilize = true,
278278
bool shouldMaintainInfo = false,
279279
GrowthRatio? maxGrowth = null,
280-
string forcastingConfidentLowerBoundColumnName = null,
281-
string forcastingConfidentUpperBoundColumnName = null,
280+
string lowerBoundConfidenceColumn = null,
281+
string upperBoundConfidenceColumn = null,
282282
float confidenceLevel = 0.95f,
283283
bool variableHorizon = false)
284284
: this(env, new SsaForecastingTransformer.Options
@@ -291,12 +291,12 @@ internal SsaForecastingEstimator(IHostEnvironment env,
291291
RankSelectionMethod = rankSelectionMethod,
292292
Rank = rank,
293293
MaxRank = maxRank,
294-
ShouldStablize = shouldStablize,
294+
ShouldStabilize = shouldStabilize,
295295
ShouldMaintainInfo = shouldMaintainInfo,
296296
MaxGrowth = maxGrowth,
297297
ConfidenceLevel = confidenceLevel,
298-
ForcastingConfidentLowerBoundColumnName = forcastingConfidentLowerBoundColumnName,
299-
ForcastingConfidentUpperBoundColumnName = forcastingConfidentUpperBoundColumnName,
298+
LowerBoundConfidenceColumn = lowerBoundConfidenceColumn,
299+
UpperBoundConfidenceColumn = upperBoundConfidenceColumn,
300300
SeriesLength = seriesLength,
301301
TrainSize = trainSize,
302302
VariableHorizon = variableHorizon,
@@ -344,14 +344,14 @@ public SchemaShape GetOutputSchema(SchemaShape inputSchema)
344344
resultDic[_options.Name] = new SchemaShape.Column(
345345
_options.Name, SchemaShape.Column.VectorKind.Vector, NumberDataViewType.Single, false);
346346

347-
if (!string.IsNullOrEmpty(_options.ForcastingConfidentUpperBoundColumnName))
347+
if (!string.IsNullOrEmpty(_options.UpperBoundConfidenceColumn))
348348
{
349-
resultDic[_options.ForcastingConfidentLowerBoundColumnName] = new SchemaShape.Column(
350-
_options.ForcastingConfidentLowerBoundColumnName, SchemaShape.Column.VectorKind.Vector,
349+
resultDic[_options.LowerBoundConfidenceColumn] = new SchemaShape.Column(
350+
_options.LowerBoundConfidenceColumn, SchemaShape.Column.VectorKind.Vector,
351351
NumberDataViewType.Single, false);
352352

353-
resultDic[_options.ForcastingConfidentUpperBoundColumnName] = new SchemaShape.Column(
354-
_options.ForcastingConfidentUpperBoundColumnName, SchemaShape.Column.VectorKind.Vector,
353+
resultDic[_options.UpperBoundConfidenceColumn] = new SchemaShape.Column(
354+
_options.UpperBoundConfidenceColumn, SchemaShape.Column.VectorKind.Vector,
355355
NumberDataViewType.Single, false);
356356
}
357357

src/Microsoft.ML.TimeSeries/SequentialForecastingTransformBase.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ internal abstract class ForecastingArgumentsBase
2828

2929
[Argument(ArgumentType.Required, HelpText = "The name of the confidence interval lower bound column.", ShortName = "cnfminname",
3030
SortOrder = 2)]
31-
public string ForcastingConfidentLowerBoundColumnName;
31+
public string LowerBoundConfidenceColumn;
3232

3333
[Argument(ArgumentType.Required, HelpText = "The name of the confidence interval upper bound column.", ShortName = "cnfmaxnname",
3434
SortOrder = 2)]
35-
public string ForcastingConfidentUpperBoundColumnName;
35+
public string UpperBoundConfidenceColumn;
3636

3737
[Argument(ArgumentType.AtMostOnce, HelpText = "The length of series from the begining used for training.", ShortName = "wnd",
3838
SortOrder = 3)]
@@ -67,8 +67,8 @@ private protected SequentialForecastingTransformBase(int windowSize, int initial
6767
}
6868

6969
private protected SequentialForecastingTransformBase(ForecastingArgumentsBase args, string name, int outputLength, IHostEnvironment env)
70-
: this(args.TrainSize, args.SeriesLength, args.Source, args.ForcastingConfidentLowerBoundColumnName,
71-
args.ForcastingConfidentUpperBoundColumnName, args.Name, name, outputLength, env)
70+
: this(args.TrainSize, args.SeriesLength, args.Source, args.LowerBoundConfidenceColumn,
71+
args.UpperBoundConfidenceColumn, args.Name, name, outputLength, env)
7272
{
7373
}
7474

src/Microsoft.ML.TimeSeries/SsaForecastingBase.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,16 +127,16 @@ internal sealed class SsaForecastingBase : SequentialForecastingTransformBase<fl
127127
internal SequenceModelerBase<Single, Single> Model;
128128

129129
public SsaForecastingBase(SsaForecastingOptions options, string name, IHostEnvironment env, SsaForecastingBaseWrapper parent)
130-
: base(options.TrainSize, 0, options.Source, options.Name, options.ForcastingConfidentLowerBoundColumnName,
131-
options.ForcastingConfidentUpperBoundColumnName, name, options.VariableHorizon ? 0: options.Horizon, env)
130+
: base(options.TrainSize, 0, options.Source, options.Name, options.LowerBoundConfidenceColumn,
131+
options.UpperBoundConfidenceColumn, name, options.VariableHorizon ? 0: options.Horizon, env)
132132
{
133133
Host.CheckUserArg(0 <= options.DiscountFactor && options.DiscountFactor <= 1, nameof(options.DiscountFactor), "Must be in the range [0, 1].");
134134
IsAdaptive = options.IsAdaptive;
135135
Horizon = options.Horizon;
136136
ConfidenceLevel = options.ConfidenceLevel;
137137
// Creating the master SSA model
138138
Model = new AdaptiveSingularSpectrumSequenceModelerInternal(Host, options.TrainSize, options.SeriesLength, options.WindowSize,
139-
options.DiscountFactor, options.RankSelectionMethod, options.Rank, options.MaxRank, !string.IsNullOrEmpty(options.ForcastingConfidentLowerBoundColumnName),
139+
options.DiscountFactor, options.RankSelectionMethod, options.Rank, options.MaxRank, !string.IsNullOrEmpty(options.LowerBoundConfidenceColumn),
140140
options.ShouldStablize, options.ShouldMaintainInfo, options.MaxGrowth);
141141

142142
StateRef = new State();

test/BaselineOutput/Common/EntryPoints/core_manifest.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4095,7 +4095,7 @@
40954095
"Default": false
40964096
},
40974097
{
4098-
"Name": "ForcastingConfidentLowerBoundColumnName",
4098+
"Name": "LowerBoundConfidenceColumn",
40994099
"Type": "String",
41004100
"Desc": "The name of the confidence interval lower bound column.",
41014101
"Aliases": [
@@ -4107,7 +4107,7 @@
41074107
"Default": null
41084108
},
41094109
{
4110-
"Name": "ForcastingConfidentUpperBoundColumnName",
4110+
"Name": "UpperBoundConfidenceColumn",
41114111
"Type": "String",
41124112
"Desc": "The name of the confidence interval upper bound column.",
41134113
"Aliases": [
@@ -4153,7 +4153,7 @@
41534153
"Default": null
41544154
},
41554155
{
4156-
"Name": "ShouldStablize",
4156+
"Name": "ShouldStabilize",
41574157
"Type": "Bool",
41584158
"Desc": "The flag determining whether the model should be stabilized.",
41594159
"Required": false,

test/Microsoft.ML.TimeSeries.Tests/TimeSeriesDirectApi.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -338,8 +338,8 @@ public void SsaForecast()
338338
ConfidenceLevel = 0.95f,
339339
Source = "Value",
340340
Name = "Forecast",
341-
ForcastingConfidentLowerBoundColumnName = "MinCnf",
342-
ForcastingConfidentUpperBoundColumnName = "MaxCnf",
341+
LowerBoundConfidenceColumn = "MinCnf",
342+
UpperBoundConfidenceColumn = "MaxCnf",
343343
WindowSize = 10,
344344
SeriesLength = 11,
345345
TrainSize = 22,
@@ -397,8 +397,8 @@ public void SsaForecastPredictionEngine()
397397
SeriesLength = 11,
398398
TrainSize = 22,
399399
Horizon = 4,
400-
ForcastingConfidentLowerBoundColumnName = "ConfidenceLowerBound",
401-
ForcastingConfidentUpperBoundColumnName = "ConfidenceUpperBound",
400+
LowerBoundConfidenceColumn = "ConfidenceLowerBound",
401+
UpperBoundConfidenceColumn = "ConfidenceUpperBound",
402402
VariableHorizon = true
403403
};
404404

@@ -413,8 +413,8 @@ public void SsaForecastPredictionEngine()
413413
var model = ml.Transforms.Text.FeaturizeText("Text_Featurized", "Text")
414414
.Append(ml.Transforms.Conversion.ConvertType("Value", "Value", DataKind.Single))
415415
.Append(ml.Forecasting.ForecastBySsa("Forecast", "Value", 10, 11, 22, 4,
416-
forcastingConfidentLowerBoundColumnName: "ConfidenceLowerBound",
417-
forcastingConfidentUpperBoundColumnName: "ConfidenceUpperBound", variableHorizon: true))
416+
lowerBoundConfidenceColumn: "ConfidenceLowerBound",
417+
upperBoundConfidenceColumn: "ConfidenceUpperBound", variableHorizon: true))
418418
.Append(ml.Transforms.Concatenate("Forecast", "Forecast", "ConfidenceLowerBound", "ConfidenceUpperBound"))
419419
.Fit(dataView);
420420

test/Microsoft.ML.TimeSeries.Tests/TimeSeriesEstimatorTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ void TestSsaForecastingEstimator()
9595

9696
// Train
9797
var pipe = new SsaForecastingEstimator(Env, "Forecast", "Value", 10, 11, 22, 4,
98-
forcastingConfidentLowerBoundColumnName: "ConfidenceLowerBound",
99-
forcastingConfidentUpperBoundColumnName: "ConfidenceUpperBound");
98+
lowerBoundConfidenceColumn: "ConfidenceLowerBound",
99+
upperBoundConfidenceColumn: "ConfidenceUpperBound");
100100

101101
var xyData = new List<TestDataXY> { new TestDataXY() { A = new float[inputSize] } };
102102
var stringData = new List<TestDataDifferntType> { new TestDataDifferntType() { data_0 = new string[inputSize] } };

0 commit comments

Comments
 (0)