@@ -22,26 +22,26 @@ internal class EmptyWriter : TextWriter
2222
2323 public class BigramAndTrigramBenchmark
2424 {
25- private string s_dataPath_Wiki ;
26- private string s_modelPath_Wiki ;
25+ private string _dataPath_Wiki ;
26+ private string _modelPath_Wiki ;
2727
2828 [ GlobalSetup ( Targets = new string [ ] { nameof ( Preceptron_CV ) , nameof ( LightGBM_CV ) } ) ]
2929 public void Setup_Preceptron_LightGBM ( )
3030 {
31- s_dataPath_Wiki = Path . GetFullPath ( TestDatasets . WikiDetox . trainFilename ) ;
31+ _dataPath_Wiki = Path . GetFullPath ( TestDatasets . WikiDetox . trainFilename ) ;
3232
33- if ( ! File . Exists ( s_dataPath_Wiki ) )
33+ if ( ! File . Exists ( _dataPath_Wiki ) )
3434 {
35- throw new FileNotFoundException ( $ "Could not find { s_dataPath_Wiki } Please ensure you have run 'build.cmd -- /t:DownloadExternalTestFiles /p:IncludeBenchmarkData=true' from the root") ;
35+ throw new FileNotFoundException ( $ "Could not find { _dataPath_Wiki } Please ensure you have run 'build.cmd -- /t:DownloadExternalTestFiles /p:IncludeBenchmarkData=true' from the root") ;
3636 }
3737 }
3838
3939 [ GlobalSetup ( Target = nameof ( WikiDetox ) ) ]
4040 public void Setup_WikiDetox ( )
4141 {
4242 Setup_Preceptron_LightGBM ( ) ;
43- s_modelPath_Wiki = Path . Combine ( Directory . GetCurrentDirectory ( ) , @"WikiModel.zip" ) ;
44- string cmd = @"CV k=5 data=" + s_dataPath_Wiki + " loader=TextLoader{quote=- sparse=- col=Label:R4:0 col=rev_id:TX:1 col=comment:TX:2 col=logged_in:BL:4 col=ns:TX:5 col=sample:TX:6 col=split:TX:7 col=year:R4:3 header=+} xf=Convert{col=logged_in type=R4} xf=CategoricalTransform{col=ns} xf=TextTransform{col=FeaturesText:comment wordExtractor=NGramExtractorTransform{ngram=2}} xf=Concat{col=Features:FeaturesText,logged_in,ns} tr=OVA{p=AveragedPerceptron{iter=10}} out={" + s_modelPath_Wiki + "}" ;
43+ _modelPath_Wiki = Path . Combine ( Directory . GetCurrentDirectory ( ) , @"WikiModel.zip" ) ;
44+ string cmd = @"CV k=5 data=" + _dataPath_Wiki + " loader=TextLoader{quote=- sparse=- col=Label:R4:0 col=rev_id:TX:1 col=comment:TX:2 col=logged_in:BL:4 col=ns:TX:5 col=sample:TX:6 col=split:TX:7 col=year:R4:3 header=+} xf=Convert{col=logged_in type=R4} xf=CategoricalTransform{col=ns} xf=TextTransform{col=FeaturesText:comment wordExtractor=NGramExtractorTransform{ngram=2}} xf=Concat{col=Features:FeaturesText,logged_in,ns} tr=OVA{p=AveragedPerceptron{iter=10}} out={" + _modelPath_Wiki + "}" ;
4545 using ( var tlc = new TlcEnvironment ( verbose : false , sensitivity : MessageSensitivity . None , outWriter : EmptyWriter . Instance ) )
4646 {
4747 Maml . MainCore ( tlc , cmd , alwaysPrintStacktrace : false ) ;
@@ -51,7 +51,7 @@ public void Setup_WikiDetox()
5151 [ Benchmark ]
5252 public void Preceptron_CV ( )
5353 {
54- string cmd = @"CV k=5 data=" + s_dataPath_Wiki + " loader=TextLoader{quote=- sparse=- col=Label:R4:0 col=rev_id:TX:1 col=comment:TX:2 col=logged_in:BL:4 col=ns:TX:5 col=sample:TX:6 col=split:TX:7 col=year:R4:3 header=+} xf=Convert{col=logged_in type=R4} xf=CategoricalTransform{col=ns} xf=TextTransform{col=FeaturesText:comment wordExtractor=NGramExtractorTransform{ngram=2}} xf=Concat{col=Features:FeaturesText,logged_in,ns} tr=OVA{p=AveragedPerceptron{iter=10}}" ;
54+ string cmd = @"CV k=5 data=" + _dataPath_Wiki + " loader=TextLoader{quote=- sparse=- col=Label:R4:0 col=rev_id:TX:1 col=comment:TX:2 col=logged_in:BL:4 col=ns:TX:5 col=sample:TX:6 col=split:TX:7 col=year:R4:3 header=+} xf=Convert{col=logged_in type=R4} xf=CategoricalTransform{col=ns} xf=TextTransform{col=FeaturesText:comment wordExtractor=NGramExtractorTransform{ngram=2}} xf=Concat{col=Features:FeaturesText,logged_in,ns} tr=OVA{p=AveragedPerceptron{iter=10}}" ;
5555 using ( var tlc = new TlcEnvironment ( verbose : false , sensitivity : MessageSensitivity . None , outWriter : EmptyWriter . Instance ) )
5656 {
5757 Maml . MainCore ( tlc , cmd , alwaysPrintStacktrace : false ) ;
@@ -61,7 +61,7 @@ public void Preceptron_CV()
6161 [ Benchmark ]
6262 public void LightGBM_CV ( )
6363 {
64- string cmd = @"CV k=5 data=" + s_dataPath_Wiki + " loader=TextLoader{quote=- sparse=- col=Label:R4:0 col=rev_id:TX:1 col=comment:TX:2 col=logged_in:BL:4 col=ns:TX:5 col=sample:TX:6 col=split:TX:7 col=year:R4:3 header=+} xf=Convert{col=logged_in type=R4} xf=CategoricalTransform{col=ns} xf=TextTransform{col=FeaturesText:comment wordExtractor=NGramExtractorTransform{ngram=2}} xf=Concat{col=Features:FeaturesText,logged_in,ns} tr=LightGBMMulticlass{}" ;
64+ string cmd = @"CV k=5 data=" + _dataPath_Wiki + " loader=TextLoader{quote=- sparse=- col=Label:R4:0 col=rev_id:TX:1 col=comment:TX:2 col=logged_in:BL:4 col=ns:TX:5 col=sample:TX:6 col=split:TX:7 col=year:R4:3 header=+} xf=Convert{col=logged_in type=R4} xf=CategoricalTransform{col=ns} xf=TextTransform{col=FeaturesText:comment wordExtractor=NGramExtractorTransform{ngram=2}} xf=Concat{col=Features:FeaturesText,logged_in,ns} tr=LightGBMMulticlass{}" ;
6565 using ( var tlc = new TlcEnvironment ( verbose : false , sensitivity : MessageSensitivity . None , outWriter : EmptyWriter . Instance ) )
6666 {
6767 Maml . MainCore ( tlc , cmd , alwaysPrintStacktrace : false ) ;
@@ -72,7 +72,7 @@ public void LightGBM_CV()
7272 public void WikiDetox ( )
7373 {
7474 string modelpath = Path . Combine ( Directory . GetCurrentDirectory ( ) , @"WikiModel.fold000.zip" ) ;
75- string cmd = @"Test data=" + s_dataPath_Wiki + " in=" + modelpath ;
75+ string cmd = @"Test data=" + _dataPath_Wiki + " in=" + modelpath ;
7676 using ( var tlc = new TlcEnvironment ( verbose : false , sensitivity : MessageSensitivity . None , outWriter : EmptyWriter . Instance ) )
7777 {
7878 Maml . MainCore ( tlc , cmd , alwaysPrintStacktrace : false ) ;
0 commit comments