Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/vowpal_wabbit.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorniruc <niruc@NIRUC1.redmond.corp.microsoft.com>2013-04-09 07:02:33 +0400
committerniruc <niruc@NIRUC1.redmond.corp.microsoft.com>2013-04-09 07:02:33 +0400
commitc0e215ecec7eddf689283271968bcdfca8984e71 (patch)
treed1a91ac39bc2df27296f872a12155cc41014b3cd /vowpalwabbit
parent8528dcdf6f19feb83eacb36b279711c82dc68135 (diff)
move all definitions in namespace VW to vw.h
Diffstat (limited to 'vowpalwabbit')
-rw-r--r--vowpalwabbit/autolink.cc1
-rw-r--r--vowpalwabbit/bfgs.cc1
-rw-r--r--vowpalwabbit/binary.cc1
-rw-r--r--vowpalwabbit/cb.cc1
-rw-r--r--vowpalwabbit/csoaa.cc1
-rw-r--r--vowpalwabbit/ect.cc1
-rw-r--r--vowpalwabbit/example.h4
-rw-r--r--vowpalwabbit/gd.cc1
-rw-r--r--vowpalwabbit/gd_mf.cc1
-rw-r--r--vowpalwabbit/lda_core.cc1
-rw-r--r--vowpalwabbit/nn.cc1
-rw-r--r--vowpalwabbit/noop.cc1
-rw-r--r--vowpalwabbit/oaa.cc1
-rw-r--r--vowpalwabbit/parser.h6
-rw-r--r--vowpalwabbit/searn_sequencetask.cc1
-rw-r--r--vowpalwabbit/sender.cc1
-rw-r--r--vowpalwabbit/simple_label.cc1
-rw-r--r--vowpalwabbit/vw.h53
-rw-r--r--vowpalwabbit/vw.vcxproj5
-rw-r--r--vowpalwabbit/vw_static.vcxproj4
-rw-r--r--vowpalwabbit/wap.cc1
21 files changed, 53 insertions, 35 deletions
diff --git a/vowpalwabbit/autolink.cc b/vowpalwabbit/autolink.cc
index 4a63ef37..8096d36d 100644
--- a/vowpalwabbit/autolink.cc
+++ b/vowpalwabbit/autolink.cc
@@ -1,6 +1,7 @@
#include "simple_label.h"
#include <float.h>
#include "parser.h"
+#include "vw.h"
namespace ALINK {
const int autoconstant = 524267083;
diff --git a/vowpalwabbit/bfgs.cc b/vowpalwabbit/bfgs.cc
index 56955350..1da7309e 100644
--- a/vowpalwabbit/bfgs.cc
+++ b/vowpalwabbit/bfgs.cc
@@ -24,6 +24,7 @@ Implementation by Miro Dudik.
#include "simple_label.h"
#include "accumulate.h"
#include <exception>
+#include "vw.h"
using namespace std;
diff --git a/vowpalwabbit/binary.cc b/vowpalwabbit/binary.cc
index d2e6108f..aa2f4856 100644
--- a/vowpalwabbit/binary.cc
+++ b/vowpalwabbit/binary.cc
@@ -1,4 +1,5 @@
#include "oaa.h"
+#include "vw.h"
namespace BINARY {
struct binary {
diff --git a/vowpalwabbit/cb.cc b/vowpalwabbit/cb.cc
index 9a60aa93..40dfd934 100644
--- a/vowpalwabbit/cb.cc
+++ b/vowpalwabbit/cb.cc
@@ -12,6 +12,7 @@ license as described in the file LICENSE.
#include "oaa.h"
#include "parse_example.h"
#include "parse_primitives.h"
+#include "vw.h"
namespace CB
{
diff --git a/vowpalwabbit/csoaa.cc b/vowpalwabbit/csoaa.cc
index 885f84b9..a15b1dcb 100644
--- a/vowpalwabbit/csoaa.cc
+++ b/vowpalwabbit/csoaa.cc
@@ -13,6 +13,7 @@ license as described in the file LICENSE.
#include "oaa.h"
#include "v_hashmap.h"
#include "parse_example.h"
+#include "vw.h"
using namespace std;
diff --git a/vowpalwabbit/ect.cc b/vowpalwabbit/ect.cc
index 35201f02..1b6116af 100644
--- a/vowpalwabbit/ect.cc
+++ b/vowpalwabbit/ect.cc
@@ -18,6 +18,7 @@ license as described in the file LICENSE.
#include "parser.h"
#include "simple_label.h"
#include "parse_args.h"
+#include "vw.h"
using namespace std;
diff --git a/vowpalwabbit/example.h b/vowpalwabbit/example.h
index 0207b80b..62a021d6 100644
--- a/vowpalwabbit/example.h
+++ b/vowpalwabbit/example.h
@@ -59,9 +59,7 @@ struct example // core example datatype.
example *alloc_example(size_t);
void dealloc_example(void(*delete_label)(void*), example&);
-namespace VW {
- void copy_example_data(example*&, example*, size_t, void(*copy_example)(void*&,void*));
-}
+
void update_example_indicies(bool audit, example* ec, uint32_t amount);
bool command_example(void*a, example* ec);
diff --git a/vowpalwabbit/gd.cc b/vowpalwabbit/gd.cc
index 9ac4e8a2..34e67522 100644
--- a/vowpalwabbit/gd.cc
+++ b/vowpalwabbit/gd.cc
@@ -27,6 +27,7 @@ license as described in the file LICENSE.
#include "simple_label.h"
#include "accumulate.h"
#include "learner.h"
+#include "vw.h"
using namespace std;
diff --git a/vowpalwabbit/gd_mf.cc b/vowpalwabbit/gd_mf.cc
index b2ebb7db..98c3454f 100644
--- a/vowpalwabbit/gd_mf.cc
+++ b/vowpalwabbit/gd_mf.cc
@@ -19,6 +19,7 @@ license as described in the file LICENSE.
#include "cache.h"
#include "simple_label.h"
#include "rand48.h"
+#include "vw.h"
using namespace std;
diff --git a/vowpalwabbit/lda_core.cc b/vowpalwabbit/lda_core.cc
index 36aa6493..6361ceb2 100644
--- a/vowpalwabbit/lda_core.cc
+++ b/vowpalwabbit/lda_core.cc
@@ -22,6 +22,7 @@ license as described in the file LICENSE.
#include "cache.h"
#include "simple_label.h"
#include "rand48.h"
+#include "vw.h"
namespace LDA {
struct lda {
diff --git a/vowpalwabbit/nn.cc b/vowpalwabbit/nn.cc
index 1c2be65c..e62c9b3a 100644
--- a/vowpalwabbit/nn.cc
+++ b/vowpalwabbit/nn.cc
@@ -14,6 +14,7 @@ license as described in the file LICENSE.
#include "cache.h"
#include "v_hashmap.h"
#include "rand48.h"
+#include "vw.h"
using namespace std;
diff --git a/vowpalwabbit/noop.cc b/vowpalwabbit/noop.cc
index cad748ca..96e9f314 100644
--- a/vowpalwabbit/noop.cc
+++ b/vowpalwabbit/noop.cc
@@ -9,6 +9,7 @@ license as described in the file LICENSE.
#include "parser.h"
#include "gd.h"
#include "simple_label.h"
+#include "vw.h"
namespace NOOP {
void learn(void* d, example*ec) {}
diff --git a/vowpalwabbit/oaa.cc b/vowpalwabbit/oaa.cc
index dcdd2d24..cccb4f5c 100644
--- a/vowpalwabbit/oaa.cc
+++ b/vowpalwabbit/oaa.cc
@@ -12,6 +12,7 @@ license as described in the file LICENSE.
#include "simple_label.h"
#include "cache.h"
#include "v_hashmap.h"
+#include "vw.h"
using namespace std;
diff --git a/vowpalwabbit/parser.h b/vowpalwabbit/parser.h
index 52045ae6..495de17f 100644
--- a/vowpalwabbit/parser.h
+++ b/vowpalwabbit/parser.h
@@ -32,12 +32,6 @@ void adjust_used_index(vw& all);
//parser control
-namespace VW {
- void start_parser(vw& all, bool do_init = true);
- void end_parser(vw& all);
- example* get_example(parser* pf);
- void finish_example(vw& all, example* ec);
-}
void make_example_available();
bool parser_done(parser* p);
diff --git a/vowpalwabbit/searn_sequencetask.cc b/vowpalwabbit/searn_sequencetask.cc
index 5446b3fc..148b56c8 100644
--- a/vowpalwabbit/searn_sequencetask.cc
+++ b/vowpalwabbit/searn_sequencetask.cc
@@ -15,6 +15,7 @@ license as described in the file LICENSE.
#include "oaa.h"
#include "csoaa.h"
#include "searn_sequencetask.h"
+#include "vw.h"
namespace SequenceTask {
SearnUtil::history_info hinfo;
diff --git a/vowpalwabbit/sender.cc b/vowpalwabbit/sender.cc
index 694a60c8..eb0d61fb 100644
--- a/vowpalwabbit/sender.cc
+++ b/vowpalwabbit/sender.cc
@@ -20,6 +20,7 @@
#include "cache.h"
#include "simple_label.h"
#include "network.h"
+#include "vw.h"
using namespace std;
diff --git a/vowpalwabbit/simple_label.cc b/vowpalwabbit/simple_label.cc
index 41f13df4..f31297cd 100644
--- a/vowpalwabbit/simple_label.cc
+++ b/vowpalwabbit/simple_label.cc
@@ -5,6 +5,7 @@
#include "simple_label.h"
#include "cache.h"
#include "rand48.h"
+#include "vw.h"
using namespace std;
diff --git a/vowpalwabbit/vw.h b/vowpalwabbit/vw.h
index 65c45b52..ddea10ad 100644
--- a/vowpalwabbit/vw.h
+++ b/vowpalwabbit/vw.h
@@ -29,20 +29,46 @@ namespace VW {
*/
void finish(vw& all);
- //The next commands deal with creating examples. Caution: VW does not all allow creation of many examples at once by default. You can adjust the exact number by tweaking ring_size.
+ void start_parser(vw& all, bool do_init = true);
+ void end_parser(vw& all);
+
- /* The simplest of two ways to create an example. An example_line is the literal line in a VW-format datafile.
- */
- example* read_example(vw& all, char* example_line);
+ //The next commands deal with creating examples. Caution: VW does not all allow creation of many examples at once by default. You can adjust the exact number by tweaking ring_size.
- //The more complex way to create an example.
typedef pair< unsigned char, vector<feature> > feature_space; //just a helper definition.
struct primitive_feature_space { //just a helper definition.
unsigned char name;
feature* fs;
size_t len; };
- //First create the hash of a namespace.
+ /* The simplest of two ways to create an example. An example_line is the literal line in a VW-format datafile.
+ */
+ example* read_example(vw& all, char* example_line);
+
+ //The more complex way to create an example.
+
+ //after you create and fill feature_spaces, get an example with everything filled in.
+ example* import_example(vw& all, primitive_feature_space* features, size_t len);
+ example* import_example(vw& all, vector< feature_space > ec_info);
+ void parse_example_label(vw&all, example&ec, string label);
+ example* new_unused_example(vw& all);
+ example* get_example(parser* pf);
+
+ void add_constant_feature(vw& all, example*ec);
+ void add_label(example* ec, float label, float weight = 1, float base = 0);
+ //notify VW that you are done with the example.
+ void finish_example(vw& all, example* ec);
+
+ void copy_example_data(example*&, example*, size_t, void(*copy_example)(void*&,void*));
+
+ // after export_example, must call releaseFeatureSpace to free native memory
+ primitive_feature_space* export_example(vw& all, example* e, size_t& len);
+ void releaseFeatureSpace(primitive_feature_space* features, size_t len);
+
+
+ // inlines
+
+ //First create the hash of a namespace.
inline uint32_t hash_space(vw& all, string s)
{
substring ss;
@@ -67,25 +93,12 @@ namespace VW {
return (uint32_t)(all.p->hasher(ss,u) & all.parse_mask);
}
- //after you create and fill feature_spaces, get an example with everything filled in.
- example* import_example(vw& all, primitive_feature_space* features, size_t len);
- example* import_example(vw& all, vector< feature_space > ec_info);
- void parse_example_label(vw&all, example&ec, string label);
- example* new_unused_example(vw& all);
- void add_constant_feature(vw& all, example*ec);
-
- void add_label(example* ec, float label, float weight = 1, float base = 0);
- //notify VW that you are done with the example.
- void finish_example(vw& all, example* ec);
-
- primitive_feature_space* export_example(vw& all, example* e, size_t& len);
- void releaseFeatureSpace(primitive_feature_space* features, size_t len);
-
inline float get_weight(vw& all, uint32_t index)
{ return all.reg.weight_vector[(index * all.reg.stride) & all.reg.weight_mask];}
inline uint32_t num_weights(vw& all)
{ return (uint32_t)all.length();}
+
}
#endif
diff --git a/vowpalwabbit/vw.vcxproj b/vowpalwabbit/vw.vcxproj
index 627a8492..93da8890 100644
--- a/vowpalwabbit/vw.vcxproj
+++ b/vowpalwabbit/vw.vcxproj
@@ -178,10 +178,7 @@
<IntDir>$(SolutionDir)x86\$(Configuration)\</IntDir>
</PropertyGroup>
<ItemGroup>
- <ClCompile Include="vw.cc" />
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="vw.h" />
+ <ClCompile Include="main.cc" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
diff --git a/vowpalwabbit/vw_static.vcxproj b/vowpalwabbit/vw_static.vcxproj
index 7b951fd3..56ab5a9c 100644
--- a/vowpalwabbit/vw_static.vcxproj
+++ b/vowpalwabbit/vw_static.vcxproj
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
@@ -314,4 +314,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
-</Project>
+</Project> \ No newline at end of file
diff --git a/vowpalwabbit/wap.cc b/vowpalwabbit/wap.cc
index c596b5b2..7d745a2d 100644
--- a/vowpalwabbit/wap.cc
+++ b/vowpalwabbit/wap.cc
@@ -13,6 +13,7 @@ license as described in the file LICENSE.
#include "cache.h"
#include "csoaa.h"
#include "oaa.h"
+#include "vw.h"
using namespace std;