Permalink
Browse files

integrated john and stephane's changes

  • Loading branch information...
2 parents ac2ed15 + d4075cb commit 89389dd11668710003c4eb80b30aae3373a79c32 @hal3 hal3 committed Jun 19, 2012
View
No changes.
View
@@ -35,7 +35,7 @@ FLAGS = $(ARCH) $(WARN_FLAGS) $(OPTIM_FLAGS) -D_FILE_OFFSET_BITS=64 -I $(BOOST_I
BINARIES = vw active_interactor
MANPAGES = vw.1
-all: vw spanning_tree
+all: vw spanning_tree library_example
%.1: %
help2man --no-info --name="Vowpal Wabbit -- fast online learning tool" ./$< > $@
@@ -48,6 +48,9 @@ spanning_tree:
vw:
cd vowpalwabbit; $(MAKE); cd ..
+library_example: vw
+ cd library; $(MAKE); cd ..
+
.FORCE:
test: .FORCE
View
@@ -1,11 +1,23 @@
-SUBDIRS = vowpalwabbit cluster
-
-nobase_include_HEADERS = vowpalwabbit/accumulate.h vowpalwabbit/comp_io.h vowpalwabbit/gd.h vowpalwabbit/io.h vowpalwabbit/noop.h vowpalwabbit/parse_primitives.h \
- vowpalwabbit/simple_label.h vowpalwabbit/allreduce.h vowpalwabbit/config.h vowpalwabbit/gd_mf.h vowpalwabbit/lda_core.h vowpalwabbit/oaa.h \
- vowpalwabbit/parse_regressor.h vowpalwabbit/sparse_dense.h vowpalwabbit/bfgs.h vowpalwabbit/constant.h vowpalwabbit/global_data.h vowpalwabbit/loss_functions.h \
- vowpalwabbit/parse_args.h vowpalwabbit/parser.h vowpalwabbit/unique_sort.h vowpalwabbit/cache.h vowpalwabbit/example.h vowpalwabbit/hash.h vowpalwabbit/network.h \
- vowpalwabbit/parse_example.h vowpalwabbit/sender.h vowpalwabbit/v_array.h vowpalwabbit/v_hashmap.h vowpalwabbit/wap.h vowpalwabbit/beam.h vowpalwabbit/searn.h \
- vowpalwabbit/searn_sequencetask.h vowpalwabbit/sequence.h vowpalwabbit/csoaa.h vowpalwabbit/ect.h
+SUBDIRS = vowpalwabbit cluster library
+
+nobase_include_HEADERS = vowpalwabbit/vw.h vowpalwabbit/allreduce.h
+
+noinst_HEADERS = vowpalwabbit/accumulate.h vowpalwabbit/oaa.h \
+ vowpalwabbit/parse_args.h vowpalwabbit/bfgs.h \
+ vowpalwabbit/parse_example.h vowpalwabbit/cache.h \
+ vowpalwabbit/parse_primitives.h vowpalwabbit/comp_io.h \
+ vowpalwabbit/parse_regressor.h vowpalwabbit/constant.h \
+ vowpalwabbit/parser.h vowpalwabbit/csoaa.h vowpalwabbit/beam.h \
+ vowpalwabbit/searn.h vowpalwabbit/ect.h \
+ vowpalwabbit/searn_sequencetask.h vowpalwabbit/example.h \
+ vowpalwabbit/sender.h vowpalwabbit/gd.h vowpalwabbit/sequence.h \
+ vowpalwabbit/gd_mf.h vowpalwabbit/simple_label.h \
+ vowpalwabbit/global_data.h vowpalwabbit/sparse_dense.h \
+ vowpalwabbit/hash.h vowpalwabbit/unique_sort.h \
+ vowpalwabbit/io.h vowpalwabbit/v_array.h \
+ vowpalwabbit/lda_core.h vowpalwabbit/v_hashmap.h \
+ vowpalwabbit/loss_functions.h vowpalwabbit/network.h \
+ vowpalwabbit/wap.h vowpalwabbit/noop.h
ACLOCAL_AMFLAGS = -I acinclude.d
View
@@ -0,0 +1,10 @@
+To get John's changes:
+ git pull git://github.com/JohnLangford/vowpal_wabbit.git master
+
+To enable use of valgrind, do:
+ ./configure --enable-profiling
+
+To do fancy learning, do
+ --exact_adaptive_norm --power_t 1
+or
+ --exact_adaptive_norm --power_t 0.5
View
@@ -1,4 +1,4 @@
-AC_INIT([vowpal_wabbit], [6.1.1], [jl@hunch.net])
+AC_INIT([vowpal_wabbit], [6.1.2], [jl@hunch.net])
AC_DEFINE([PACKAGE_URL],["https://github.com/JohnLangford/vowpal_wabbit"],[project url])
AM_CONFIG_HEADER(vowpalwabbit/config.h)
AM_INIT_AUTOMAKE()
@@ -63,5 +63,6 @@ AC_CONFIG_FILES([
Makefile
vowpalwabbit/Makefile
cluster/Makefile
+ library/Makefile
])
AC_OUTPUT
View
@@ -1,5 +1,2 @@
library_example: library_example.cc ../vowpalwabbit/libvw.a
- g++ -g -o $@ -l boost_program_options -l z -l pthread $< -L ../vowpalwabbit -l vw -l allreduce
-
-temp2: temp2.cc ../vowpalwabbit/libvw.a
- g++ -g -o $@ -l boost_program_options -l z -l pthread $< -L ../vowpalwabbit -l vw -l allreduce
+ g++ -g -o $@ $< -L ../vowpalwabbit -l vw -l allreduce -l boost_program_options -l z -l pthread
View
@@ -0,0 +1,9 @@
+bin_PROGRAMS = library_example
+
+library_example_SOURCES = library_example.cc
+library_example_LDADD = ../vowpalwabbit/libvw.la ../vowpalwabbit/liballreduce.la
+
+ACLOCAL_AMFLAGS = -I acinclude.d
+
+INCLUDES = ${BOOST_CPPFLAGS} ${ZLIB_CPPFLAGS} ${PTHREAD_CFLAGS}
+AM_LDFLAGS = ${BOOST_LDFLAGS} ${BOOST_PROGRAM_OPTIONS_LIB} ${ZLIB_LDFLAGS} ${PTHREAD_LIBS}
@@ -13,7 +13,7 @@ inline feature vw_feature_from_string(vw& v, string fstr, unsigned long seed, fl
int main(int argc, char *argv[])
{
- vw vw = VW::initialize("--hash all -q st --noconstant -i train.w");
+ vw vw = VW::initialize("--hash all -q st --noconstant");
example *vec2 = VW::read_example(vw, "|s p^the_man w^the w^man |t p^le_homme w^le w^homme");
vw.learn(&vw, vec2);
View
@@ -7,10 +7,10 @@ all: config.h depend $(BINARIES)
%.1: %
help2man --no-info --name="Vowpal Wabbit -- fast online learning tool" ./$< > $@
-config.h:
+config.h: ../configure.ac
echo \#define PACKAGE_VERSION \"`grep AC_INIT ../configure.ac | cut -d '[' -f 3 | cut -d ']' -f 1`\" > config.h
-vw_SOURCES = $(shell grep vw_SOURCES Makefile.am | cut -d '=' -f 2)
+vw_SOURCES = $(shell grep libvw_la_SOURCES Makefile.am | cut -d '=' -f 2)
depend: $(vw_SOURCES) config.h
gcc -MM $(vw_SOURCES) > depend
@@ -32,7 +32,7 @@ libvw.a: $(filter-out vw.o,$(vw_OBJECTS))
ar rcs $@ $+
vw: vw.o libvw.a liballreduce.a
- $(COMPILER) $(FLAGS) -L$(BOOST_LIBRARY) -L. $(LIBS) -o $@ $< -l vw -l allreduce
+ $(COMPILER) $(FLAGS) -L$(BOOST_LIBRARY) -L. -o $@ $< -l vw -l allreduce $(LIBS)
active_interactor: active_interactor.cc
$(COMPILER) $(FLAGS) -o $@ $+
View
@@ -1,13 +1,16 @@
-lib_LTLIBRARIES = liballreduce.la
+lib_LTLIBRARIES = liballreduce.la libvw.la
liballreduce_la_SOURCES = allreduce.cc
include_HEADERS = allreduce.h
bin_PROGRAMS = vw active_interactor
-vw_SOURCES = hash.cc global_data.cc io.cc parse_regressor.cc parse_primitives.cc unique_sort.cc cache.cc simple_label.cc oaa.cc ect.cc csoaa.cc v_hashmap.cc wap.cc beam.cc searn.cc searn_sequencetask.cc sequence.cc parse_example.cc sparse_dense.cc network.cc parse_args.cc accumulate.cc gd.cc lda_core.cc gd_mf.cc bfgs.cc noop.cc example.cc parser.cc vw.cc loss_functions.cc sender.cc
-vw_LDADD = allreduce.o
-vw_DEPENDENCIES = allreduce.o
+libvw_la_SOURCES = hash.cc global_data.cc io.cc parse_regressor.cc parse_primitives.cc unique_sort.cc cache.cc simple_label.cc oaa.cc ect.cc csoaa.cc v_hashmap.cc wap.cc beam.cc searn.cc searn_sequencetask.cc sequence.cc parse_example.cc sparse_dense.cc network.cc parse_args.cc accumulate.cc gd.cc lda_core.cc gd_mf.cc bfgs.cc noop.cc example.cc parser.cc vw.cc loss_functions.cc sender.cc
+
+vw_SOURCES = vw.cc
+
+vw_LDADD = libvw.la liballreduce.la
+vw_DEPENDENCIES = libvw.la liballreduce.la
active_interactor_SOURCES = active_interactor.cc
@@ -240,6 +240,18 @@ vw::vw()
per_feature_regularizer_output = "";
per_feature_regularizer_text = "";
+ searn = false;
+ searn_nb_actions = 1;
+ searn_base_learner = "csoaa";
+ searn_trained_nb_policies = 1;
+ searn_total_nb_policies = 1;
+ searn_beta = 0.5;
+ searn_task = "sequence";
+ searn_sequencetask_history = 1;
+ searn_sequencetask_features = 0;
+ searn_sequencetask_bigrams = false;
+ searn_sequencetask_bigram_features = false;
+
nonormalize = false;
l1_lambda = 0.0;
l2_lambda = 0.0;
@@ -250,8 +262,9 @@ vw::vw()
unique_id = 0;
total = 1;
node = 0;
-
+
ngram = 0;
+ skips = 0;
adaptive = false;
add_constant = true;
View
@@ -8,14 +8,102 @@ embodied in the content of this file are licensed under the BSD
#define GLOBAL_DATA_H
#include <vector>
#include <stdint.h>
+#include <cstdio>
#include "v_array.h"
#include "parse_primitives.h"
#include "loss_functions.h"
#include "comp_io.h"
#include "example.h"
#include "config.h"
-const std::string version = PACKAGE_VERSION;
+struct version_struct {
+ int major;
+ int minor;
+ int rev;
+ version_struct(int maj, int min, int rv)
+ {
+ major = maj;
+ minor = min;
+ rev = rv;
+ }
+ version_struct(const char* v_str)
+ {
+ from_string(v_str);
+ }
+ void operator=(version_struct v){
+ major = v.major;
+ minor = v.minor;
+ rev = v.rev;
+ }
+ void operator=(const char* v_str){
+ from_string(v_str);
+ }
+ bool operator==(version_struct v){
+ return (major == v.major && minor == v.minor && rev == v.rev);
+ }
+ bool operator==(const char* v_str){
+ version_struct v_tmp(v_str);
+ return (*this == v_tmp);
+ }
+ bool operator!=(version_struct v){
+ return !(*this == v);
+ }
+ bool operator!=(const char* v_str){
+ version_struct v_tmp(v_str);
+ return (*this != v_tmp);
+ }
+ bool operator>=(version_struct v){
+ if(major < v.major) return false;
+ if(major > v.major) return true;
+ if(minor < v.minor) return false;
+ if(minor > v.minor) return true;
+ if(rev >= v.rev ) return true;
+ return false;
+ }
+ bool operator>=(const char* v_str){
+ version_struct v_tmp(v_str);
+ return (*this >= v_tmp);
+ }
+ bool operator>(version_struct v){
+ if(major < v.major) return false;
+ if(major > v.major) return true;
+ if(minor < v.minor) return false;
+ if(minor > v.minor) return true;
+ if(rev > v.rev ) return true;
+ return false;
+ }
+ bool operator>(const char* v_str){
+ version_struct v_tmp(v_str);
+ return (*this > v_tmp);
+ }
+ bool operator<=(version_struct v){
+ return !(*this < v);
+ }
+ bool operator<=(const char* v_str){
+ version_struct v_tmp(v_str);
+ return (*this <= v_tmp);
+ }
+ bool operator<(version_struct v){
+ return !(*this >= v);
+ }
+ bool operator<(const char* v_str){
+ version_struct v_tmp(v_str);
+ return (*this < v_tmp);
+ }
+ std::string to_string() const
+ {
+ char v_str[32];
+ std::sprintf(v_str,"%d.%d.%d",major,minor,rev);
+ std::string s = v_str;
+ return s;
+ }
+ void from_string(const char* str)
+ {
+ std::sscanf(str,"%d.%d.%d",&major,&minor,&rev);
+ }
+};
+
+const version_struct version(PACKAGE_VERSION);
typedef float weight;
@@ -52,6 +140,16 @@ struct vw {
bool sequence;
bool searn;
+ size_t searn_nb_actions;
+ std::string searn_base_learner;
+ size_t searn_trained_nb_policies;
+ size_t searn_total_nb_policies;
+ float searn_beta;
+ std::string searn_task;
+ size_t searn_sequencetask_history;
+ size_t searn_sequencetask_features;
+ bool searn_sequencetask_bigrams;
+ bool searn_sequencetask_bigram_features;
size_t stride;
Oops, something went wrong.

0 comments on commit 89389dd

Please sign in to comment.