Skip to content

Commit

Permalink
accomodate floating point issue for large number of actions
Browse files Browse the repository at this point in the history
improved end to end tests
version bump
closing issue #52
  • Loading branch information
eisber committed Jul 22, 2016
1 parent 4350dec commit ce41972
Show file tree
Hide file tree
Showing 11 changed files with 82 additions and 141 deletions.
4 changes: 2 additions & 2 deletions client/ClientDecisionService/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
[assembly: System.Runtime.InteropServices.ComVisible(false)]
[assembly: System.CLSCompliant(false)]
[assembly: System.Runtime.InteropServices.Guid("a991c863-165c-4fd5-b388-45b13df358a8")]
[assembly: System.Reflection.AssemblyVersion("2.0.0.2")]
[assembly: System.Reflection.AssemblyFileVersion("2.0.0.2")]
[assembly: System.Reflection.AssemblyVersion("2.0.0.3")]
[assembly: System.Reflection.AssemblyFileVersion("2.0.0.3")]


4 changes: 2 additions & 2 deletions client/JoinServerUploader/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
[assembly: System.Runtime.InteropServices.ComVisible(false)]
[assembly: System.CLSCompliant(true)]
[assembly: System.Runtime.InteropServices.Guid("324bd225-38a8-476f-bc96-ad563697274d")]
[assembly: System.Reflection.AssemblyVersion("2.0.0.2")]
[assembly: System.Reflection.AssemblyFileVersion("2.0.0.2")]
[assembly: System.Reflection.AssemblyVersion("2.0.0.3")]
[assembly: System.Reflection.AssemblyFileVersion("2.0.0.3")]


4 changes: 2 additions & 2 deletions client/explore/GenericTopSlotExplorer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ public override ExplorerDecision<int[]> MapContext(PRG prg, ActionProbability[]
if (total == 0)
throw new ArgumentException("At least one probability must be positive.");

if (Math.Abs(total - 1f) > 1e-6)
throw new ArgumentException("Probabilities must sum to one.");
if (Math.Abs(total - 1f) > 1e-4)
throw new ArgumentException($"Probabilities must sum to one, but {Math.Abs(total - 1f)} was received.");

float draw = prg.UniformUnitInterval();

Expand Down
2 changes: 1 addition & 1 deletion client/version.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ClientLibraryAssemblyVersion>2.0.0.2</ClientLibraryAssemblyVersion>
<ClientLibraryAssemblyVersion>2.0.0.3</ClientLibraryAssemblyVersion>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion provisioning/test/APITestDriveTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
namespace Microsoft.Research.DecisionServiceTest
{
[TestClass]
public class APITestDriveTestClass : ProvisioningBaseTest
public class APITestDriveTestClass : ProvisioningTest
{
private const string deploymentOutput = @"
{
Expand Down
43 changes: 5 additions & 38 deletions provisioning/test/EndToEndOnlineTrainerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,46 +10,13 @@

namespace Microsoft.Research.DecisionServiceTest
{
[TestClass]
public class EndToEndTest : ProvisioningBaseTest
public partial class ProvisioningTest
{
private const string deploymentOutput = @"
{
""management Center URL"": {
""type"": ""String"",
""value"": ""https://mc-sccwor75dvlcuchl6tlbcaux42.azurewebsites.net""
},
""management Center Password"": {
""type"": ""String"",
""value"": ""vmfhd4lsmxkbk""
},
""client Library URL"": {
""type"": ""String"",
""value"": ""https://storagesccwor75dvlcu.blob.core.windows.net/mwt-settings/client?sv=2015-07-08&sr=b&sig=lre%2BGTE9wfgXucIR62FAY8NiQQEADgbq2x26ur3bCsA%3D&st=2016-07-11T17%3A59%3A04Z&se=2017-07-11T18%3A00%3A04Z&sp=r""
},
""web Service Token"": {
""type"": ""String"",
""value"": ""57dx6h2tw464k""
},
""online Trainer Token"": {
""type"": ""String"",
""value"": ""votzwbdgrkcoe""
},
""online Trainer URL"": {
""type"": ""String"",
""value"": ""http://trainer-sccwor75dvlcuchl6tlbcaux42.cloudapp.net""
}
}
";
// public EndToEndTest() : base(deploymentOutput) { }

//public EndToEndTest()
//{
// this.deleteOnCleanup = true;
//}

/// <summary>
/// Remove [Ignore] to run individually
/// </summary>
[TestMethod]
[Ignore]
[TestCategory("End to End")]
[Priority(2)]
public void E2ERankerStochasticRewards()
Expand Down
26 changes: 0 additions & 26 deletions provisioning/test/ProvisionOnly.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,36 @@

namespace Microsoft.Research.DecisionServiceTest
{
public class ProvisioningBaseTest
[TestClass]
public partial class ProvisioningTest
{
[TestMethod]
[Ignore]
public void ProvisionOnlyTest()
{
this.Initialize();

Assert.IsNotNull(this.managementCenterUrl);
Assert.IsNotNull(this.managementPassword);
Assert.IsNotNull(this.onlineTrainerUrl);
Assert.IsNotNull(this.onlineTrainerToken);
Assert.IsNotNull(this.webServiceToken);
Assert.IsNotNull(this.settingsUrl);
}

[TestMethod]
[TestCategory("End to End")]
[Priority(2)]
public async Task AllEndToEndTests()
{
this.Initialize();

await SimplePolicyTest();

E2ERankerStochasticRewards();
}


private JObject deploymentOutput;

protected bool deleteOnCleanup;
Expand All @@ -41,18 +69,44 @@ private static string GetConfiguration(string name)
return ConfigurationManager.AppSettings[name];
}

protected ProvisioningBaseTest()
public ProvisioningTest()
{
this.deleteOnCleanup = true;
}
// string deploymentOutput = @"
//{
// ""management Center URL"": {
// ""type"": ""String"",
// ""value"": ""https://mc-sccwor75dvlcuchl6tlbcaux42.azurewebsites.net""
// },
// ""management Center Password"": {
// ""type"": ""String"",
// ""value"": ""vmfhd4lsmxkbk""
// },
// ""client Library URL"": {
// ""type"": ""String"",
// ""value"": ""https://storagesccwor75dvlcu.blob.core.windows.net/mwt-settings/client?sv=2015-07-08&sr=b&sig=lre%2BGTE9wfgXucIR62FAY8NiQQEADgbq2x26ur3bCsA%3D&st=2016-07-11T17%3A59%3A04Z&se=2017-07-11T18%3A00%3A04Z&sp=r""
// },
// ""web Service Token"": {
// ""type"": ""String"",
// ""value"": ""57dx6h2tw464k""
// },
// ""online Trainer Token"": {
// ""type"": ""String"",
// ""value"": ""votzwbdgrkcoe""
// },
// ""online Trainer URL"": {
// ""type"": ""String"",
// ""value"": ""http://trainer-sccwor75dvlcuchl6tlbcaux42.cloudapp.net""
// }
//}
//";
// this.deploymentOutput = JObject.Parse(deploymentOutput);
// this.ParseDeploymentOutputs();

protected ProvisioningBaseTest(string deploymentOutput)
{
this.deleteOnCleanup = false;
this.deploymentOutput = JObject.Parse(deploymentOutput);
this.ParseDeploymentOutputs();
}



protected void ConfigureDecisionService(string trainArguments = null, float? initialExplorationEpsilon = null, bool? isExplorationEnabled = null)
{
using (var wc = new WebClient())
Expand Down Expand Up @@ -160,7 +214,6 @@ private ResourceManagementClient CreateResourceManagementClient()
return armClient;
}

[TestInitialize]
public void Initialize()
{
// re-using deployment
Expand Down
26 changes: 1 addition & 25 deletions provisioning/test/SimplePolicyHttpTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,8 @@
namespace Microsoft.Research.DecisionServiceTest
{
[TestClass]
public class SimplePolicyHttpTestClass : ProvisioningBaseTest
public class SimplePolicyHttpTestClass : ProvisioningTest
{
private const string deploymentOutput = @"
{
""management Center URL"": {
""type"": ""String"",
""value"": ""https://dmunitef1924c44cc9b28ff02c1fe6650b-mc-a5u7oqwv2xzi4.azurewebsites.net""
},
""management Center Password"": {
""type"": ""String"",
""value"": ""dkqwm7lmlgipi""
},
""client Library Url"": {
""type"": ""String"",
""value"": ""https://storagea5u7oqwv2xzi4.blob.core.windows.net/mwt-settings/client?sv=2015-07-08&sr=b&sig=I9W6J8HabJnjYiKilrAGLTb8Fo3yULI7raXuBohsm3M%3D&st=2016-06-20T04%3A11%3A44Z&se=2017-06-20T04%3A12%3A44Z&sp=r""
},
""online Trainer Token"": {
""type"": ""String"",
""value"": ""7cbzr4zikh6ko""
},
""online Trainer URL"": {
""type"": ""String"",
""value"": ""http://dmunitef1924c44cc9b28ff02c1fe6650b-trainer-a5u7oqwv2xzi4.cloudapp.net""
}
}";
private const string contextType = "policy";

private Dictionary<string, int> freq;
Expand All @@ -49,7 +26,6 @@ public class SimplePolicyHttpTestClass : ProvisioningBaseTest
WebClient wc;

public SimplePolicyHttpTestClass()
: base(deploymentOutput)
{
wc = new WebClient();
wc.Headers.Add("auth", managementPassword);
Expand Down
38 changes: 5 additions & 33 deletions provisioning/test/SimplePolicyTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,46 +9,18 @@

namespace Microsoft.Research.DecisionServiceTest
{
[TestClass]
public class SimplePolicyTestClass : ProvisioningBaseTest
public partial class ProvisioningTest
{
private const string deploymentOutput = @"
{
""management Center URL"": {
""type"": ""String"",
""value"": ""https://mc-sccwor75dvlcuchl6tlbcaux42.azurewebsites.net""
},
""management Center Password"": {
""type"": ""String"",
""value"": ""vmfhd4lsmxkbk""
},
""client Library URL"": {
""type"": ""String"",
""value"": ""https://storagesccwor75dvlcu.blob.core.windows.net/mwt-settings/client?sv=2015-07-08&sr=b&sig=lre%2BGTE9wfgXucIR62FAY8NiQQEADgbq2x26ur3bCsA%3D&st=2016-07-11T17%3A59%3A04Z&se=2017-07-11T18%3A00%3A04Z&sp=r""
},
""web Service Token"": {
""type"": ""String"",
""value"": ""57dx6h2tw464k""
},
""online Trainer Token"": {
""type"": ""String"",
""value"": ""votzwbdgrkcoe""
},
""online Trainer URL"": {
""type"": ""String"",
""value"": ""http://trainer-sccwor75dvlcuchl6tlbcaux42.cloudapp.net""
}
}
";

private Dictionary<string, int> freq;
private string[] features;
private Random rnd;
private int eventCount;

// public SimplePolicyTestClass() : base(deploymentOutput) { }

/// <summary>
/// Remove [Ignore] to run individually
/// </summary>
[TestMethod]
[Ignore]
[TestCategory("End to End")]
[Priority(2)]
public async Task SimplePolicyTest()
Expand Down
3 changes: 1 addition & 2 deletions provisioning/test/ds-provisioning.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,8 @@
<Compile Include="APITestDriveTest.cs" />
<Compile Include="EndToEndOnlineTrainerTest.cs" />
<Compile Include="SimplePolicyHttpTest.cs" />
<Compile Include="ProvisioningBaseTest.cs" />
<Compile Include="ProvisioningTest.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ProvisionOnly.cs" />
<Compile Include="SimplePolicyTest.cs" />
</ItemGroup>
<ItemGroup>
Expand Down

0 comments on commit ce41972

Please sign in to comment.