-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cb_adf and cb_explore_adf: Setting --cb_type mtr as default (#1838)
* cb_adf: Setting --cb_type mtr as default * cb_explore_adf.cc: default cb_type mtr * Removed dm from cb_type help, since dm is not supported * Fixed test 84 * cb_adf: fixed test 87 * cb_explore_adf: Fixed test 129 * cb_explore_adf: Fixed test 138 * cb_explore_adf: Fixed test 158 * Fixing Java tests errors * Update tests * Precision * Precision * ordering * precision * Fix ips->mtr in comment + adding spaces in cmd
- Loading branch information
1 parent
f159ff6
commit f96e5fb
Showing
13 changed files
with
167 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,128 +1,128 @@ | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using VW; | ||
|
||
namespace cs_unittest | ||
{ | ||
[TestClass] | ||
public class TestArgumentsClass | ||
{ | ||
[TestMethod] | ||
[TestCategory("Vowpal Wabbit")] | ||
public void TestArguments() | ||
{ | ||
using (var vw = new VowpalWabbit(new VowpalWabbitSettings("--cb_explore_adf --epsilon 0.3 --interact ud") { Verbose = true })) | ||
{ | ||
// --cb_explore_adf --epsilon 0.3 --interact ud --cb_adf--csoaa_ldf multiline --csoaa_rank | ||
Console.WriteLine(vw.Arguments.CommandLine); | ||
Assert.IsTrue(vw.Arguments.CommandLine.Contains("--cb_explore_adf")); | ||
Assert.IsTrue(vw.Arguments.CommandLine.Contains("--epsilon 0.3")); | ||
Assert.IsTrue(vw.Arguments.CommandLine.Contains("--interact ud")); | ||
Assert.IsTrue(vw.Arguments.CommandLine.Contains("--csoaa_ldf multiline")); | ||
Assert.IsTrue(vw.Arguments.CommandLine.Contains("--csoaa_rank")); | ||
vw.SaveModel("args.model"); | ||
} | ||
|
||
using (var vw = new VowpalWabbit(new VowpalWabbitSettings { ModelStream = File.Open("args.model", FileMode.Open) })) | ||
{ | ||
Console.WriteLine(vw.Arguments.CommandLine); | ||
// --no_stdin--bit_precision 18--cb_explore_adf--epsilon 0.300000--cb_adf--cb_type ips --csoaa_ldf multiline--csoaa_rank--interact ud | ||
|
||
Assert.IsTrue(vw.Arguments.CommandLine.Contains("--no_stdin")); | ||
Assert.IsTrue(vw.Arguments.CommandLine.Contains("--bit_precision 18")); | ||
Assert.IsTrue(vw.Arguments.CommandLine.Contains("--cb_explore_adf")); | ||
Assert.IsTrue(vw.Arguments.CommandLine.Contains("--epsilon 0.3")); | ||
Assert.IsTrue(vw.Arguments.CommandLine.Contains("--interact ud")); | ||
Assert.IsTrue(vw.Arguments.CommandLine.Contains("--csoaa_ldf multiline")); | ||
Assert.IsTrue(vw.Arguments.CommandLine.Contains("--csoaa_rank")); | ||
Assert.IsTrue(vw.Arguments.CommandLine.Contains("--cb_type ips")); | ||
} | ||
} | ||
|
||
[TestMethod] | ||
[TestCategory("Vowpal Wabbit")] | ||
public void TestQuietAndTestArguments() | ||
{ | ||
using (var vw = new VowpalWabbit("--quiet -t")) | ||
{ | ||
vw.SaveModel("args.model"); | ||
} | ||
|
||
using (var vw = new VowpalWabbitModel(new VowpalWabbitSettings { ModelStream = File.Open("args.model", FileMode.Open) })) | ||
{ | ||
Assert.IsFalse(vw.Arguments.CommandLine.Contains("--quiet")); | ||
Assert.IsTrue(vw.Arguments.CommandLine.Contains("-t")); | ||
|
||
using (var vwSub = new VowpalWabbit(new VowpalWabbitSettings { Model = vw })) | ||
{ | ||
Assert.IsTrue(vwSub.Arguments.CommandLine.Contains("--quiet")); | ||
Assert.IsTrue(vwSub.Arguments.CommandLine.Contains("-t")); | ||
} | ||
} | ||
|
||
using (var vw = new VowpalWabbit("")) | ||
{ | ||
vw.SaveModel("args.model"); | ||
} | ||
|
||
using (var vw = new VowpalWabbitModel(new VowpalWabbitSettings { ModelStream = File.Open("args.model", FileMode.Open) })) | ||
{ | ||
Assert.IsFalse(vw.Arguments.CommandLine.Contains("--quiet")); | ||
Assert.IsTrue(vw.Arguments.CommandLine.Contains("-t")); | ||
|
||
using (var vwSub = new VowpalWabbit(new VowpalWabbitSettings { Model = vw })) | ||
{ | ||
Assert.IsTrue(vwSub.Arguments.CommandLine.Contains("--quiet")); | ||
Assert.IsTrue(vwSub.Arguments.CommandLine.Contains("-t")); | ||
} | ||
} | ||
} | ||
|
||
[TestMethod] | ||
[TestCategory("Vowpal Wabbit")] | ||
public void TestArgumentDeDup() | ||
{ | ||
using (var vw = new VowpalWabbit("-l 0.3 -l 0.3 --learning_rate 0.3 -f model1 --save_resume -q ab")) | ||
{ | ||
Assert.AreEqual(0.3f, vw.Native.Arguments.LearningRate); | ||
} | ||
|
||
try | ||
{ | ||
using (var vw = | ||
new VowpalWabbit( | ||
"--cb 2 --cb_type ips --cb_type dm --learning_rate 0.1 -f model_bad --save_resume -q ab")) | ||
{ | ||
Assert.AreEqual(0.1f, vw.Native.Arguments.LearningRate); | ||
} | ||
|
||
Assert.Fail("Disagreering arguments not detected"); | ||
} | ||
catch (VowpalWabbitException) | ||
{ } | ||
|
||
using (var vw = new VowpalWabbit("-i model1 --save_resume")) | ||
{ | ||
Assert.AreEqual(0.5f, vw.Native.Arguments.LearningRate); | ||
} | ||
|
||
using (var vw = new VowpalWabbit("-i model1 --save_resume -q ab -l 0.4")) | ||
{ | ||
Assert.AreEqual(0.4f, vw.Native.Arguments.LearningRate); | ||
} | ||
|
||
// make sure different representations of arguments are matched | ||
using (var vw = new VowpalWabbit("--cb_explore_adf --epsilon 0.1 -f model2")) | ||
{ } | ||
|
||
using (var vw = new VowpalWabbit("--cb_explore_adf --epsilon 0.1000 -i model2")) | ||
{ } | ||
} | ||
} | ||
} | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using VW; | ||
|
||
namespace cs_unittest | ||
{ | ||
[TestClass] | ||
public class TestArgumentsClass | ||
{ | ||
[TestMethod] | ||
[TestCategory("Vowpal Wabbit")] | ||
public void TestArguments() | ||
{ | ||
using (var vw = new VowpalWabbit(new VowpalWabbitSettings("--cb_explore_adf --epsilon 0.3 --interact ud") { Verbose = true })) | ||
{ | ||
// --cb_explore_adf --epsilon 0.3 --interact ud --cb_adf --csoaa_ldf multiline --csoaa_rank | ||
Console.WriteLine(vw.Arguments.CommandLine); | ||
Assert.IsTrue(vw.Arguments.CommandLine.Contains("--cb_explore_adf")); | ||
Assert.IsTrue(vw.Arguments.CommandLine.Contains("--epsilon 0.3")); | ||
Assert.IsTrue(vw.Arguments.CommandLine.Contains("--interact ud")); | ||
Assert.IsTrue(vw.Arguments.CommandLine.Contains("--csoaa_ldf multiline")); | ||
Assert.IsTrue(vw.Arguments.CommandLine.Contains("--csoaa_rank")); | ||
vw.SaveModel("args.model"); | ||
} | ||
|
||
using (var vw = new VowpalWabbit(new VowpalWabbitSettings { ModelStream = File.Open("args.model", FileMode.Open) })) | ||
{ | ||
Console.WriteLine(vw.Arguments.CommandLine); | ||
// --no_stdin --bit_precision 18 --cb_explore_adf --epsilon 0.300000 --cb_adf --cb_type mtr --csoaa_ldf multiline --csoaa_rank --interact ud | ||
|
||
Assert.IsTrue(vw.Arguments.CommandLine.Contains("--no_stdin")); | ||
Assert.IsTrue(vw.Arguments.CommandLine.Contains("--bit_precision 18")); | ||
Assert.IsTrue(vw.Arguments.CommandLine.Contains("--cb_explore_adf")); | ||
Assert.IsTrue(vw.Arguments.CommandLine.Contains("--epsilon 0.3")); | ||
Assert.IsTrue(vw.Arguments.CommandLine.Contains("--interact ud")); | ||
Assert.IsTrue(vw.Arguments.CommandLine.Contains("--csoaa_ldf multiline")); | ||
Assert.IsTrue(vw.Arguments.CommandLine.Contains("--csoaa_rank")); | ||
Assert.IsTrue(vw.Arguments.CommandLine.Contains("--cb_type mtr")); | ||
} | ||
} | ||
|
||
[TestMethod] | ||
[TestCategory("Vowpal Wabbit")] | ||
public void TestQuietAndTestArguments() | ||
{ | ||
using (var vw = new VowpalWabbit("--quiet -t")) | ||
{ | ||
vw.SaveModel("args.model"); | ||
} | ||
|
||
using (var vw = new VowpalWabbitModel(new VowpalWabbitSettings { ModelStream = File.Open("args.model", FileMode.Open) })) | ||
{ | ||
Assert.IsFalse(vw.Arguments.CommandLine.Contains("--quiet")); | ||
Assert.IsTrue(vw.Arguments.CommandLine.Contains("-t")); | ||
|
||
using (var vwSub = new VowpalWabbit(new VowpalWabbitSettings { Model = vw })) | ||
{ | ||
Assert.IsTrue(vwSub.Arguments.CommandLine.Contains("--quiet")); | ||
Assert.IsTrue(vwSub.Arguments.CommandLine.Contains("-t")); | ||
} | ||
} | ||
|
||
using (var vw = new VowpalWabbit("")) | ||
{ | ||
vw.SaveModel("args.model"); | ||
} | ||
|
||
using (var vw = new VowpalWabbitModel(new VowpalWabbitSettings { ModelStream = File.Open("args.model", FileMode.Open) })) | ||
{ | ||
Assert.IsFalse(vw.Arguments.CommandLine.Contains("--quiet")); | ||
Assert.IsTrue(vw.Arguments.CommandLine.Contains("-t")); | ||
|
||
using (var vwSub = new VowpalWabbit(new VowpalWabbitSettings { Model = vw })) | ||
{ | ||
Assert.IsTrue(vwSub.Arguments.CommandLine.Contains("--quiet")); | ||
Assert.IsTrue(vwSub.Arguments.CommandLine.Contains("-t")); | ||
} | ||
} | ||
} | ||
|
||
[TestMethod] | ||
[TestCategory("Vowpal Wabbit")] | ||
public void TestArgumentDeDup() | ||
{ | ||
using (var vw = new VowpalWabbit("-l 0.3 -l 0.3 --learning_rate 0.3 -f model1 --save_resume -q ab")) | ||
{ | ||
Assert.AreEqual(0.3f, vw.Native.Arguments.LearningRate); | ||
} | ||
|
||
try | ||
{ | ||
using (var vw = | ||
new VowpalWabbit( | ||
"--cb 2 --cb_type ips --cb_type dm --learning_rate 0.1 -f model_bad --save_resume -q ab")) | ||
{ | ||
Assert.AreEqual(0.1f, vw.Native.Arguments.LearningRate); | ||
} | ||
|
||
Assert.Fail("Disagreering arguments not detected"); | ||
} | ||
catch (VowpalWabbitException) | ||
{ } | ||
|
||
using (var vw = new VowpalWabbit("-i model1 --save_resume")) | ||
{ | ||
Assert.AreEqual(0.5f, vw.Native.Arguments.LearningRate); | ||
} | ||
|
||
using (var vw = new VowpalWabbit("-i model1 --save_resume -q ab -l 0.4")) | ||
{ | ||
Assert.AreEqual(0.4f, vw.Native.Arguments.LearningRate); | ||
} | ||
|
||
// make sure different representations of arguments are matched | ||
using (var vw = new VowpalWabbit("--cb_explore_adf --epsilon 0.1 -f model2")) | ||
{ } | ||
|
||
using (var vw = new VowpalWabbit("--cb_explore_adf --epsilon 0.1000 -i model2")) | ||
{ } | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
0:0,1:0,2:0 | ||
|
||
1:-0.182022,0:0.342521 | ||
1:0,0:0.239436 | ||
|
||
1:-0.256651,0:0.461775 | ||
1:0,0:0.359153 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
0:0.0833333,1:0.0833333,2:0.0833333,3:0.0833333,4:0.0833333,5:0.0833333,6:0.0833333,7:0.0833333,8:0.0833333,9:0.0833333,10:0.0833333,11:0.0833333 | ||
|
||
6:0.816667,5:0.0166667,9:0.0166667,2:0.0166667,10:0.0166667,1:0.0166667,3:0.0166667,7:0.0166667,4:0.0166667,0:0.0166667,8:0.0166667,11:0.0166667 | ||
|
||
6:0.816667,5:0.0166667,9:0.0166667,2:0.0166667,1:0.0166667,3:0.0166667,10:0.0166667,4:0.0166667,0:0.0166667,7:0.0166667,8:0.0166667,11:0.0166667 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
0:0.333333,1:0.333333,2:0.333333 | ||
|
||
1:0.628209,0:0.371791 | ||
1:0.559575,0:0.440425 | ||
|
||
1:0.67226,0:0.32774 | ||
1:0.588836,0:0.411165 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.