@@ -91,7 +91,7 @@ public TestImpl(RunContextBase ctx) :
91
91
/// <summary>
92
92
/// Run the predictor with given args and check if it adds up
93
93
/// </summary>
94
- protected void Run ( RunContext ctx , int digitsOfPrecision = DigitsOfPrecision )
94
+ protected void Run ( RunContext ctx , int digitsOfPrecision = DigitsOfPrecision , NumberParseOption parseOption = NumberParseOption . Default )
95
95
{
96
96
Contracts . Assert ( IsActive ) ;
97
97
List < string > args = new List < string > ( ) ;
@@ -164,8 +164,8 @@ protected void Run(RunContext ctx, int digitsOfPrecision = DigitsOfPrecision)
164
164
return ;
165
165
}
166
166
var consOutPath = ctx . StdoutPath ( ) ;
167
- TestCore ( ctx , ctx . Command . ToString ( ) , runcmd , digitsOfPrecision : digitsOfPrecision ) ;
168
- bool matched = consOutPath . CheckEqualityNormalized ( digitsOfPrecision ) ;
167
+ TestCore ( ctx , ctx . Command . ToString ( ) , runcmd , digitsOfPrecision : digitsOfPrecision , parseOption : parseOption ) ;
168
+ bool matched = consOutPath . CheckEqualityNormalized ( digitsOfPrecision , parseOption : parseOption ) ;
169
169
170
170
if ( modelPath != null && ( ctx . Summary || ctx . SaveAsIni ) )
171
171
{
@@ -191,7 +191,7 @@ protected void Run(RunContext ctx, int digitsOfPrecision = DigitsOfPrecision)
191
191
}
192
192
193
193
MainForTest ( _env , LogWriter , str ) ;
194
- files . ForEach ( file => CheckEqualityNormalized ( dir , file , digitsOfPrecision : digitsOfPrecision ) ) ;
194
+ files . ForEach ( file => CheckEqualityNormalized ( dir , file , digitsOfPrecision : digitsOfPrecision , parseOption : parseOption ) ) ;
195
195
}
196
196
197
197
if ( ctx . Command == Cmd . Train || ctx . Command == Cmd . Test || ctx . ExpectedToFail )
@@ -209,12 +209,12 @@ protected void Run(RunContext ctx, int digitsOfPrecision = DigitsOfPrecision)
209
209
210
210
// Run result processor on the console output.
211
211
RunResultProcessorTest ( new string [ ] { consOutPath . Path } , rpOutPath , rpArgs ) ;
212
- CheckEqualityNormalized ( dir , rpName , digitsOfPrecision : digitsOfPrecision ) ;
212
+ CheckEqualityNormalized ( dir , rpName , digitsOfPrecision : digitsOfPrecision , parseOption : parseOption ) ;
213
213
}
214
214
215
215
// Check the prediction output against its baseline.
216
216
Contracts . Assert ( predOutPath != null ) ;
217
- predOutPath . CheckEquality ( digitsOfPrecision : digitsOfPrecision ) ;
217
+ predOutPath . CheckEquality ( digitsOfPrecision : digitsOfPrecision , parseOption : parseOption ) ;
218
218
219
219
if ( ctx . Command == Cmd . TrainTest )
220
220
{
@@ -257,7 +257,7 @@ protected void Run(RunContext ctx, int digitsOfPrecision = DigitsOfPrecision)
257
257
// Redirect output to the individual log and run the test.
258
258
var ctx2 = ctx . TestCtx ( ) ;
259
259
OutputPath consOutPath2 = ctx2 . StdoutPath ( ) ;
260
- TestCore ( ctx2 , "Test" , runcmd , digitsOfPrecision : digitsOfPrecision ) ;
260
+ TestCore ( ctx2 , "Test" , runcmd , digitsOfPrecision , parseOption ) ;
261
261
262
262
if ( CheckTestOutputMatchesTrainTest ( consOutPath . Path , consOutPath2 . Path , 1 ) )
263
263
File . Delete ( consOutPath2 . Path ) ;
@@ -339,25 +339,27 @@ public string GetLoaderTransformSettings(TestDataset dataset)
339
339
/// </summary>
340
340
protected void RunAllTests (
341
341
IList < PredictorAndArgs > predictors , IList < TestDataset > datasets ,
342
- string [ ] extraSettings = null , string extraTag = "" , bool summary = false , int digitsOfPrecision = DigitsOfPrecision )
342
+ string [ ] extraSettings = null , string extraTag = "" , bool summary = false ,
343
+ int digitsOfPrecision = DigitsOfPrecision , NumberParseOption parseOption = NumberParseOption . Default )
343
344
{
344
345
Contracts . Assert ( IsActive ) ;
345
346
foreach ( TestDataset dataset in datasets )
346
347
{
347
348
foreach ( PredictorAndArgs predictor in predictors )
348
- RunOneAllTests ( predictor , dataset , extraSettings , extraTag , summary , digitsOfPrecision ) ;
349
+ RunOneAllTests ( predictor , dataset , extraSettings , extraTag , summary , digitsOfPrecision , parseOption ) ;
349
350
}
350
351
}
351
352
352
353
/// <summary>
353
354
/// Run TrainTest, CV, and TrainSaveTest for a single predictor on a single dataset.
354
355
/// </summary>
355
356
protected void RunOneAllTests ( PredictorAndArgs predictor , TestDataset dataset ,
356
- string [ ] extraSettings = null , string extraTag = "" , bool summary = false , int digitsOfPrecision = DigitsOfPrecision )
357
+ string [ ] extraSettings = null , string extraTag = "" , bool summary = false ,
358
+ int digitsOfPrecision = DigitsOfPrecision , NumberParseOption parseOption = NumberParseOption . Default )
357
359
{
358
360
Contracts . Assert ( IsActive ) ;
359
- Run_TrainTest ( predictor , dataset , extraSettings , extraTag , summary : summary , digitsOfPrecision : digitsOfPrecision ) ;
360
- Run_CV ( predictor , dataset , extraSettings , extraTag , useTest : true , digitsOfPrecision : digitsOfPrecision ) ;
361
+ Run_TrainTest ( predictor , dataset , extraSettings , extraTag , summary : summary , digitsOfPrecision : digitsOfPrecision , parseOption : parseOption ) ;
362
+ Run_CV ( predictor , dataset , extraSettings , extraTag , useTest : true , digitsOfPrecision : digitsOfPrecision , parseOption : parseOption ) ;
361
363
}
362
364
363
365
/// <summary>
@@ -385,10 +387,12 @@ protected RunContext Run_Train(PredictorAndArgs predictor, TestDataset dataset,
385
387
/// Run a train-test unit test
386
388
/// </summary>
387
389
protected void Run_TrainTest ( PredictorAndArgs predictor , TestDataset dataset ,
388
- string [ ] extraSettings = null , string extraTag = "" , bool expectFailure = false , bool summary = false , bool saveAsIni = false , int digitsOfPrecision = DigitsOfPrecision )
390
+ string [ ] extraSettings = null , string extraTag = "" , bool expectFailure = false , bool summary = false ,
391
+ bool saveAsIni = false , int digitsOfPrecision = DigitsOfPrecision ,
392
+ NumberParseOption parseOption = NumberParseOption . Default )
389
393
{
390
394
RunContext ctx = new RunContext ( this , Cmd . TrainTest , predictor , dataset , extraSettings , extraTag , expectFailure : expectFailure , summary : summary , saveAsIni : saveAsIni ) ;
391
- Run ( ctx , digitsOfPrecision ) ;
395
+ Run ( ctx , digitsOfPrecision , parseOption ) ;
392
396
}
393
397
394
398
// REVIEW: Remove TrainSaveTest and supporting code.
@@ -423,7 +427,8 @@ protected void Run_Test(PredictorAndArgs predictor, TestDataset dataset, string
423
427
/// <paramref name="useTest"/> is set.
424
428
/// </summary>
425
429
protected void Run_CV ( PredictorAndArgs predictor , TestDataset dataset ,
426
- string [ ] extraSettings = null , string extraTag = "" , bool useTest = false , int digitsOfPrecision = DigitsOfPrecision )
430
+ string [ ] extraSettings = null , string extraTag = "" , bool useTest = false ,
431
+ int digitsOfPrecision = DigitsOfPrecision , NumberParseOption parseOption = NumberParseOption . Default )
427
432
{
428
433
if ( useTest )
429
434
{
@@ -433,7 +438,7 @@ protected void Run_CV(PredictorAndArgs predictor, TestDataset dataset,
433
438
dataset . trainFilename = dataset . testFilename ;
434
439
}
435
440
RunContext cvCtx = new RunContext ( this , Cmd . CV , predictor , dataset , extraSettings , extraTag ) ;
436
- Run ( cvCtx , digitsOfPrecision ) ;
441
+ Run ( cvCtx , digitsOfPrecision , parseOption ) ;
437
442
}
438
443
439
444
/// <summary>
0 commit comments