Skip to content

Commit 26de502

Browse files
committed
VS2015 + CNTK starting integration
1 parent 4ead8c3 commit 26de502

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+2099
-874
lines changed

ChangeLog

Whitespace-only changes.

INSTALL

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
When working off the master branch try just typing 'make'. For
2+
releases do the below.
3+
14
Installation Instructions
25
*************************
36

NEWS

Whitespace-only changes.

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ These prerequisites are usually pre-installed on many platforms. However, you ma
2020
manager (*yum*, *apt*, *MacPorts*, *brew*, ...) to install missing software.
2121

2222
- [Boost](http://www.boost.org) library, with the `Boost::Program_Options` library option enabled.
23+
- The zlib compression library + headers. In linux distros: package `zlib-devel` (Red Hat/CentOS), or `zlib1g-dev` (Ubuntu/Debian)
2324
- lsb-release (RedHat/CentOS: redhat-lsb-core, Debian: lsb-release, Ubuntu: you're all set, OSX: not required)
2425
- GNU *autotools*: *autoconf*, *automake*, *libtool*, *autoheader*, et. al. This is not a strict prereq. On many systems (notably Ubuntu with `libboost-program-options-dev` installed), the provided `Makefile` works fine.
2526
- (optional) [git](http://git-scm.com) if you want to check out the latest version of *vowpal wabbit*,

c_test/c_test.vcxproj

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<ItemGroup Label="ProjectConfigurations">
44
<ProjectConfiguration Include="DebugLeakCheck|Win32">
55
<Configuration>DebugLeakCheck</Configuration>
@@ -36,39 +36,39 @@
3636
<ConfigurationType>Application</ConfigurationType>
3737
<UseDebugLibraries>true</UseDebugLibraries>
3838
<CharacterSet>MultiByte</CharacterSet>
39-
<PlatformToolset>v120</PlatformToolset>
39+
<PlatformToolset>v140</PlatformToolset>
4040
</PropertyGroup>
4141
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugLeakCheck|Win32'" Label="Configuration">
4242
<ConfigurationType>Application</ConfigurationType>
4343
<UseDebugLibraries>true</UseDebugLibraries>
4444
<CharacterSet>MultiByte</CharacterSet>
45-
<PlatformToolset>v120</PlatformToolset>
45+
<PlatformToolset>v140</PlatformToolset>
4646
</PropertyGroup>
4747
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
4848
<ConfigurationType>Application</ConfigurationType>
4949
<UseDebugLibraries>true</UseDebugLibraries>
5050
<CharacterSet>MultiByte</CharacterSet>
51-
<PlatformToolset>v120</PlatformToolset>
51+
<PlatformToolset>v140</PlatformToolset>
5252
</PropertyGroup>
5353
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugLeakCheck|x64'" Label="Configuration">
5454
<ConfigurationType>Application</ConfigurationType>
5555
<UseDebugLibraries>true</UseDebugLibraries>
5656
<CharacterSet>MultiByte</CharacterSet>
57-
<PlatformToolset>v120</PlatformToolset>
57+
<PlatformToolset>v140</PlatformToolset>
5858
</PropertyGroup>
5959
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
6060
<ConfigurationType>Application</ConfigurationType>
6161
<UseDebugLibraries>false</UseDebugLibraries>
6262
<WholeProgramOptimization>true</WholeProgramOptimization>
6363
<CharacterSet>MultiByte</CharacterSet>
64-
<PlatformToolset>v120</PlatformToolset>
64+
<PlatformToolset>v140</PlatformToolset>
6565
</PropertyGroup>
6666
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
6767
<ConfigurationType>Application</ConfigurationType>
6868
<UseDebugLibraries>false</UseDebugLibraries>
6969
<WholeProgramOptimization>true</WholeProgramOptimization>
7070
<CharacterSet>MultiByte</CharacterSet>
71-
<PlatformToolset>v120</PlatformToolset>
71+
<PlatformToolset>v140</PlatformToolset>
7272
</PropertyGroup>
7373
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
7474
<ImportGroup Label="ExtensionSettings">

cluster/cluster.vcxproj

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<ItemGroup Label="ProjectConfigurations">
44
<ProjectConfiguration Include="DebugLeakCheck|Win32">
55
<Configuration>DebugLeakCheck</Configuration>
@@ -32,45 +32,46 @@
3232
<RootNamespace>cluster</RootNamespace>
3333
<ProjectName>spanning_tree</ProjectName>
3434
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\vowpalwabbit\</SolutionDir>
35+
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
3536
</PropertyGroup>
3637
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
3738
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
3839
<ConfigurationType>Application</ConfigurationType>
3940
<UseDebugLibraries>true</UseDebugLibraries>
4041
<CharacterSet>Unicode</CharacterSet>
41-
<PlatformToolset>v120</PlatformToolset>
42+
<PlatformToolset>v140</PlatformToolset>
4243
</PropertyGroup>
4344
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugLeakCheck|Win32'" Label="Configuration">
4445
<ConfigurationType>Application</ConfigurationType>
4546
<UseDebugLibraries>true</UseDebugLibraries>
4647
<CharacterSet>Unicode</CharacterSet>
47-
<PlatformToolset>v120</PlatformToolset>
48+
<PlatformToolset>v140</PlatformToolset>
4849
</PropertyGroup>
4950
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
5051
<ConfigurationType>Application</ConfigurationType>
5152
<UseDebugLibraries>true</UseDebugLibraries>
5253
<CharacterSet>Unicode</CharacterSet>
53-
<PlatformToolset>v120</PlatformToolset>
54+
<PlatformToolset>v140</PlatformToolset>
5455
</PropertyGroup>
5556
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugLeakCheck|x64'" Label="Configuration">
5657
<ConfigurationType>Application</ConfigurationType>
5758
<UseDebugLibraries>true</UseDebugLibraries>
5859
<CharacterSet>Unicode</CharacterSet>
59-
<PlatformToolset>v120</PlatformToolset>
60+
<PlatformToolset>v140</PlatformToolset>
6061
</PropertyGroup>
6162
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
6263
<ConfigurationType>Application</ConfigurationType>
6364
<UseDebugLibraries>false</UseDebugLibraries>
6465
<WholeProgramOptimization>true</WholeProgramOptimization>
6566
<CharacterSet>Unicode</CharacterSet>
66-
<PlatformToolset>v120</PlatformToolset>
67+
<PlatformToolset>v140</PlatformToolset>
6768
</PropertyGroup>
6869
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
6970
<ConfigurationType>Application</ConfigurationType>
7071
<UseDebugLibraries>false</UseDebugLibraries>
7172
<WholeProgramOptimization>true</WholeProgramOptimization>
7273
<CharacterSet>Unicode</CharacterSet>
73-
<PlatformToolset>v120</PlatformToolset>
74+
<PlatformToolset>v140</PlatformToolset>
7475
</PropertyGroup>
7576
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
7677
<Import Project="$(SolutionDir)Build.props" />

cs/azure/Join/QueueDictionary.cs

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
using System;
2+
using System.Collections.Generic;
3+
4+
namespace VowpalWabbit.Azure.Join
5+
{
6+
public class QueueDictionary<TKey, TValue>
7+
{
8+
public class Item
9+
{
10+
public TKey Key { get; set; }
11+
12+
public TValue Value { get; set; }
13+
}
14+
15+
private readonly LinkedList<Item> queue = new LinkedList<Item>();
16+
17+
private readonly Dictionary<TKey, LinkedListNode<Item>> index = new Dictionary<TKey, LinkedListNode<Item>>();
18+
19+
public IEnumerable<Item> DequeueIf(Predicate<TValue> pred)
20+
{
21+
while (queue.First != null && pred(queue.First.Value.Value))
22+
{
23+
var item = queue.First.Value;
24+
25+
queue.RemoveFirst();
26+
index.Remove(item.Key);
27+
28+
yield return item;
29+
}
30+
}
31+
32+
public TValue Remove(TKey key)
33+
{
34+
LinkedListNode<Item> node;
35+
if (!index.TryGetValue(key, out node))
36+
return default(TValue);
37+
38+
var value = node.Value.Value;
39+
40+
queue.Remove(node);
41+
index.Remove(key);
42+
43+
return value;
44+
}
45+
46+
public void Enqueue(TKey key, TValue value)
47+
{
48+
var node = queue.AddLast(new Item { Key = key, Value = value });
49+
index.Add(key, node);
50+
}
51+
}
52+
}

cs/azure/Trainer/LearnEventProcessorHost.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ private async Task StartInternalAsync(OnlineTrainerSettingsInternal settings, On
201201
serviceBusConnectionStringBuilder.EntityPath = string.Empty;
202202

203203
this.eventProcessorHost = new EventProcessorHost(settings.Metadata.ApplicationID, joinedEventhubName,
204-
EventHubConsumerGroup.DefaultGroupName, serviceBusConnectionStringBuilder.ToString(), settings.StorageConnectionString);
204+
settings.JoinedEventHubConsumerGroup, serviceBusConnectionStringBuilder.ToString(), settings.StorageConnectionString);
205205

206206
// used by this.InitialOffsetProvider if no checkpointed state is found
207207
this.eventHubStartDateTimeUtc = settings.EventHubStartDateTimeUtc;

cs/azure/Trainer/OnlineTrainerSettingsInternal.cs

+6
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
// </copyright>
77
// --------------------------------------------------------------------------------------------------------------------
88

9+
using Microsoft.ServiceBus.Messaging;
910
using System;
1011
using VW.Azure.Trainer.Checkpoint;
1112

@@ -41,6 +42,11 @@ public class OnlineTrainerSettingsInternal
4142
/// </summary>
4243
public string JoinedEventHubConnectionString { get; set; }
4344

45+
/// <summary>
46+
/// Consumer group used for joined events.
47+
/// </summary>
48+
public string JoinedEventHubConsumerGroup { get; set; } = EventHubConsumerGroup.DefaultGroupName;
49+
4450
/// <summary>
4551
/// Evaluation output Azure Eventhub connection string.
4652
/// </summary>

cs/azure/Trainer/Operations/EvalOperation.cs

+12-12
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ public sealed class EvalEventData
3434
[JsonProperty("name")]
3535
public string Name { get; set; }
3636

37-
[JsonProperty("cost")]
38-
public float Cost { get; set; }
37+
[JsonProperty("weightedcost")]
38+
public float WeightedCost { get; set; }
3939

40-
[JsonProperty("prob")]
41-
public float Probability { get; set; }
40+
[JsonProperty("importanceweight")]
41+
public float ImportanceWeight { get; set; }
4242

4343
[JsonProperty("timestamp")]
4444
public DateTime Timestamp { get; set; }
@@ -155,24 +155,24 @@ private IEnumerable<EvalEventData> OfflineEvaluateInternal(TrainerResult trainer
155155
Name = "Latest Policy",
156156
// calcuate expectation under current randomized policy (using current exploration strategy)
157157
// VW action is 0-based, label Action is 1 based
158-
Cost = (trainerResult.Label.Cost * pi_a_x) / p_a_x,
159-
Probability = pi_a_x / p_a_x
158+
WeightedCost = (trainerResult.Label.Cost * pi_a_x) / p_a_x,
159+
ImportanceWeight = pi_a_x / p_a_x
160160
};
161161

162162
// the one currently running
163163
yield return new EvalEventData
164164
{
165165
Name = "Deployed Policy",
166-
Cost = trainerResult.Label.Cost,
167-
Probability = 1 // for deployed policy just use the observed cost
166+
WeightedCost = trainerResult.Label.Cost,
167+
ImportanceWeight = 1 // for deployed policy just use the observed cost
168168
};
169169

170170
// Default = choosing the action that's supplied by caller
171171
yield return new EvalEventData
172172
{
173173
Name = "Default Policy",
174-
Cost = VowpalWabbitContextualBanditUtil.GetUnbiasedCost(trainerResult.Label.Action, (uint)1, trainerResult.Label.Cost, trainerResult.Label.Probability),
175-
Probability = trainerResult.Label.Action == 1 ? 1 / (trainerResult.ObservedProbabilities[0] * (1 - trainerResult.ProbabilityOfDrop)) : 0
174+
WeightedCost = VowpalWabbitContextualBanditUtil.GetUnbiasedCost(trainerResult.Label.Action, (uint)1, trainerResult.Label.Cost, trainerResult.Label.Probability),
175+
ImportanceWeight = trainerResult.Label.Action == 1 ? 1 / (trainerResult.ObservedProbabilities[0] * (1 - trainerResult.ProbabilityOfDrop)) : 0
176176
};
177177

178178
// per action tag policies
@@ -186,8 +186,8 @@ private IEnumerable<EvalEventData> OfflineEvaluateInternal(TrainerResult trainer
186186
yield return new EvalEventData
187187
{
188188
Name = name,
189-
Cost = VowpalWabbitContextualBanditUtil.GetUnbiasedCost(trainerResult.Label.Action, (uint)action, trainerResult.Label.Cost, trainerResult.Label.Probability),
190-
Probability = trainerResult.Label.Action == action ? 1 / (trainerResult.ObservedProbabilities[action - 1] * (1 - trainerResult.ProbabilityOfDrop)) : 0
189+
WeightedCost = VowpalWabbitContextualBanditUtil.GetUnbiasedCost(trainerResult.Label.Action, (uint)action, trainerResult.Label.Cost, trainerResult.Label.Probability),
190+
ImportanceWeight = trainerResult.Label.Action == action ? 1 / (trainerResult.ObservedProbabilities[action - 1] * (1 - trainerResult.ProbabilityOfDrop)) : 0
191191
};
192192
}
193193
}

0 commit comments

Comments
 (0)