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:
authorJohn Langford <jl@hunch.net>2014-12-27 19:12:06 +0300
committerJohn Langford <jl@hunch.net>2014-12-27 19:12:06 +0300
commitdf46a62636dc9a7b8e3be9268a3e78ad0e7eea46 (patch)
treefec4aa65f765a181054bc93c6f5e02c00f3e184d
parent0756521558967dc87341377a69185adb1d9c14b9 (diff)
fix python compile
-rw-r--r--vowpalwabbit/autolink.cc2
-rw-r--r--vowpalwabbit/bs.cc4
-rw-r--r--vowpalwabbit/cb_algs.cc6
-rw-r--r--vowpalwabbit/cbify.cc2
-rw-r--r--vowpalwabbit/csoaa.cc6
-rw-r--r--vowpalwabbit/ect.cc2
-rw-r--r--vowpalwabbit/global_data.cc2
-rw-r--r--vowpalwabbit/global_data.h2
-rw-r--r--vowpalwabbit/kernel_svm.cc8
-rw-r--r--vowpalwabbit/lda_core.cc2
-rw-r--r--vowpalwabbit/log_multi.cc2
-rw-r--r--vowpalwabbit/lrq.cc4
-rw-r--r--vowpalwabbit/nn.cc6
-rw-r--r--vowpalwabbit/oaa.cc7
-rw-r--r--vowpalwabbit/parse_args.cc17
-rw-r--r--vowpalwabbit/parse_regressor.cc10
-rw-r--r--vowpalwabbit/scorer.cc4
-rw-r--r--vowpalwabbit/search.cc4
-rw-r--r--vowpalwabbit/stagewise_poly.cc2
-rw-r--r--vowpalwabbit/vw.h2
20 files changed, 48 insertions, 46 deletions
diff --git a/vowpalwabbit/autolink.cc b/vowpalwabbit/autolink.cc
index 7b56c699..88ac351f 100644
--- a/vowpalwabbit/autolink.cc
+++ b/vowpalwabbit/autolink.cc
@@ -47,7 +47,7 @@ namespace ALINK {
data.d = (uint32_t)vm["autolink"].as<size_t>();
data.stride_shift = all.reg.stride_shift;
- all.file_options << " --autolink " << data.d;
+ *all.file_options << " --autolink " << data.d;
learner<autolink>& ret = init_learner(&data, all.l);
ret.set_learn(predict_or_learn<true>);
diff --git a/vowpalwabbit/bs.cc b/vowpalwabbit/bs.cc
index 9ee117af..f55467a6 100644
--- a/vowpalwabbit/bs.cc
+++ b/vowpalwabbit/bs.cc
@@ -254,7 +254,7 @@ namespace BS {
data.B = (uint32_t)vm["bootstrap"].as<size_t>();
//append bs with number of samples to options_from_file so it is saved to regressor later
- all.file_options << " --bootstrap " << data.B;
+ *all.file_options << " --bootstrap " << data.B;
std::string type_string("mean");
@@ -275,7 +275,7 @@ namespace BS {
}
else //by default use mean
data.bs_type = BS_TYPE_MEAN;
- all.file_options << " --bs_type " << type_string;
+ *all.file_options << " --bs_type " << type_string;
data.pred_vec.reserve(data.B);
data.all = &all;
diff --git a/vowpalwabbit/cb_algs.cc b/vowpalwabbit/cb_algs.cc
index 0c111379..58193a05 100644
--- a/vowpalwabbit/cb_algs.cc
+++ b/vowpalwabbit/cb_algs.cc
@@ -515,7 +515,7 @@ namespace CB_ALGS
vm = add_options(all, cb_opts);
- all.file_options << " --cb " << nb_actions;
+ *all.file_options << " --cb " << nb_actions;
all.sd->k = nb_actions;
@@ -529,7 +529,7 @@ namespace CB_ALGS
std::string type_string;
type_string = vm["cb_type"].as<std::string>();
- all.file_options << " --cb_type " << type_string;
+ *all.file_options << " --cb_type " << type_string;
if (type_string.compare("dr") == 0)
c.cb_type = CB_TYPE_DR;
@@ -556,7 +556,7 @@ namespace CB_ALGS
else {
//by default use doubly robust
c.cb_type = CB_TYPE_DR;
- all.file_options << " --cb_type dr";
+ *all.file_options << " --cb_type dr";
}
if (eval)
diff --git a/vowpalwabbit/cbify.cc b/vowpalwabbit/cbify.cc
index 4b813fef..feded927 100644
--- a/vowpalwabbit/cbify.cc
+++ b/vowpalwabbit/cbify.cc
@@ -392,7 +392,7 @@ namespace CBIFY {
vm = add_options(all, cb_opts);
data.k = (uint32_t)vm["cbify"].as<size_t>();
- all.file_options << " --cbify " << data.k;
+ *all.file_options << " --cbify " << data.k;
all.p->lp = MULTICLASS::mc_label;
learner<cbify>* l;
diff --git a/vowpalwabbit/csoaa.cc b/vowpalwabbit/csoaa.cc
index ce613a21..26956d86 100644
--- a/vowpalwabbit/csoaa.cc
+++ b/vowpalwabbit/csoaa.cc
@@ -77,7 +77,7 @@ namespace CSOAA {
nb_actions = (uint32_t)vm["csoaa"].as<size_t>();
//append csoaa with nb_actions to file_options so it is saved to regressor later
- all.file_options << " --csoaa " << nb_actions;
+ *all.file_options << " --csoaa " << nb_actions;
all.p->lp = cs_label;
all.sd->k = nb_actions;
@@ -665,12 +665,12 @@ namespace LabelDict {
if( vm.count("csoaa_ldf") ){
ldf_arg = vm["csoaa_ldf"].as<string>();
- all.file_options << " --csoaa_ldf " << ldf_arg;
+ *all.file_options << " --csoaa_ldf " << ldf_arg;
}
else {
ldf_arg = vm["wap_ldf"].as<string>();
ld.is_wap = true;
- all.file_options << " --wap_ldf " << ldf_arg;
+ *all.file_options << " --wap_ldf " << ldf_arg;
}
if ( vm.count("ldf_override") )
ldf_arg = vm["ldf_override"].as<string>();
diff --git a/vowpalwabbit/ect.cc b/vowpalwabbit/ect.cc
index 3fd3c673..ec1aef5f 100644
--- a/vowpalwabbit/ect.cc
+++ b/vowpalwabbit/ect.cc
@@ -384,7 +384,7 @@ namespace ECT
} else
data.errors = 0;
//append error flag to options_from_file so it is saved in regressor file later
- all.file_options << " --ect " << data.k << " --error " << data.errors;
+ *all.file_options << " --ect " << data.k << " --error " << data.errors;
all.p->lp = MULTICLASS::mc_label;
size_t wpp = create_circuit(all, data, data.k, data.errors+1);
diff --git a/vowpalwabbit/global_data.cc b/vowpalwabbit/global_data.cc
index 05dc5f46..825977d5 100644
--- a/vowpalwabbit/global_data.cc
+++ b/vowpalwabbit/global_data.cc
@@ -250,6 +250,8 @@ vw::vw()
data_filename = "";
+ file_options = new std::stringstream;
+
bfgs = false;
hessian_on = false;
active = false;
diff --git a/vowpalwabbit/global_data.h b/vowpalwabbit/global_data.h
index 86bd2d15..fffe8b55 100644
--- a/vowpalwabbit/global_data.h
+++ b/vowpalwabbit/global_data.h
@@ -200,7 +200,7 @@ struct vw {
double normalized_sum_norm_x;
po::options_description opts;
- std::stringstream file_options;
+ std::stringstream* file_options;
vector<std::string> args;
void* /*Search::search*/ searchstr;
diff --git a/vowpalwabbit/kernel_svm.cc b/vowpalwabbit/kernel_svm.cc
index 1c89cc52..0584958c 100644
--- a/vowpalwabbit/kernel_svm.cc
+++ b/vowpalwabbit/kernel_svm.cc
@@ -855,7 +855,7 @@ namespace KSVM
params.lambda = all.l2_lambda;
- all.file_options <<" --lambda "<< params.lambda;
+ *all.file_options <<" --lambda "<< params.lambda;
cerr<<"Lambda = "<<params.lambda<<endl;
@@ -866,7 +866,7 @@ namespace KSVM
else
kernel_type = string("linear");
- all.file_options <<" --kernel "<< kernel_type;
+ *all.file_options <<" --kernel "<< kernel_type;
cerr<<"Kernel = "<<kernel_type<<endl;
@@ -875,7 +875,7 @@ namespace KSVM
float bandwidth = 1.;
if(vm.count("bandwidth")) {
bandwidth = vm["bandwidth"].as<float>();
- all.file_options <<" --bandwidth "<<bandwidth;
+ *all.file_options <<" --bandwidth "<<bandwidth;
}
cerr<<"bandwidth = "<<bandwidth<<endl;
params.kernel_params = &calloc_or_die<double>();
@@ -886,7 +886,7 @@ namespace KSVM
int degree = 2;
if(vm.count("degree")) {
degree = vm["degree"].as<int>();
- all.file_options <<" --degree "<<degree;
+ *all.file_options <<" --degree "<<degree;
}
cerr<<"degree = "<<degree<<endl;
params.kernel_params = &calloc_or_die<int>();
diff --git a/vowpalwabbit/lda_core.cc b/vowpalwabbit/lda_core.cc
index 016c146e..69027dc3 100644
--- a/vowpalwabbit/lda_core.cc
+++ b/vowpalwabbit/lda_core.cc
@@ -769,7 +769,7 @@ base_learner* setup(vw&all, po::variables_map& vm)
all.random_weights = true;
all.add_constant = false;
- all.file_options << " --lda " << all.lda;
+ *all.file_options << " --lda " << all.lda;
if (all.eta > 1.)
{
diff --git a/vowpalwabbit/log_multi.cc b/vowpalwabbit/log_multi.cc
index 746be9e7..a0d6fc35 100644
--- a/vowpalwabbit/log_multi.cc
+++ b/vowpalwabbit/log_multi.cc
@@ -514,7 +514,7 @@ namespace LOG_MULTI
vm = add_options(all, opts);
data->k = (uint32_t)vm["log_multi"].as<size_t>();
- all.file_options << " --log_multi " << data->k;
+ *all.file_options << " --log_multi " << data->k;
if (vm.count("no_progress"))
data->progress = false;
diff --git a/vowpalwabbit/lrq.cc b/vowpalwabbit/lrq.cc
index d7ff5a7b..a2c2205d 100644
--- a/vowpalwabbit/lrq.cc
+++ b/vowpalwabbit/lrq.cc
@@ -202,14 +202,14 @@ namespace LRQ {
else
lrq.dropout = false;
- all.file_options << " --lrqdropout ";
+ *all.file_options << " --lrqdropout ";
lrq.lrpairs = vm["lrq"].as<vector<string> > ();
for (vector<string>::iterator i = lrq.lrpairs.begin ();
i != lrq.lrpairs.end ();
++i)
- all.file_options << " --lrq " << *i;
+ *all.file_options << " --lrq " << *i;
if (! all.quiet)
{
diff --git a/vowpalwabbit/nn.cc b/vowpalwabbit/nn.cc
index 5e426a94..428c9f02 100644
--- a/vowpalwabbit/nn.cc
+++ b/vowpalwabbit/nn.cc
@@ -323,11 +323,11 @@ CONVERSE: // That's right, I'm using goto. So sue me.
//first parse for number of hidden units
n.k = (uint32_t)vm["nn"].as<size_t>();
- all.file_options << " --nn " << n.k;
+ *all.file_options << " --nn " << n.k;
if ( vm.count("dropout") ) {
n.dropout = true;
- all.file_options << " --dropout ";
+ *all.file_options << " --dropout ";
}
if ( vm.count("meanfield") ) {
@@ -346,7 +346,7 @@ CONVERSE: // That's right, I'm using goto. So sue me.
if (vm.count ("inpass")) {
n.inpass = true;
- all.file_options << " --inpass";
+ *all.file_options << " --inpass";
}
diff --git a/vowpalwabbit/oaa.cc b/vowpalwabbit/oaa.cc
index ea2fe56e..c7c87c6d 100644
--- a/vowpalwabbit/oaa.cc
+++ b/vowpalwabbit/oaa.cc
@@ -78,13 +78,12 @@ namespace OAA {
base_learner* setup(vw& all, po::variables_map& vm)
{
oaa& data = calloc_or_die<oaa>();
- //first parse for number of actions
- data.k = vm["oaa"].as<size_t>();
- //append oaa with nb_actions to options_from_file so it is saved to regressor later
- all.file_options << " --oaa " << data.k;
+ data.k = vm["oaa"].as<size_t>();
data.shouldOutput = all.raw_prediction > 0;
data.all = &all;
+
+ *all.file_options << " --oaa " << data.k;
all.p->lp = mc_label;
learner<oaa>& l = init_learner(&data, all.l, data.k);
diff --git a/vowpalwabbit/parse_args.cc b/vowpalwabbit/parse_args.cc
index 6515c8e8..9f5d071a 100644
--- a/vowpalwabbit/parse_args.cc
+++ b/vowpalwabbit/parse_args.cc
@@ -353,7 +353,7 @@ void parse_feature_tweaks(vw& all, po::variables_map& vm)
if (vm.count("affix")) {
parse_affix_argument(all, vm["affix"].as<string>());
- all.file_options << " --affix " << vm["affix"].as<string>();
+ *all.file_options << " --affix " << vm["affix"].as<string>();
}
if(vm.count("ngram")){
@@ -1018,7 +1018,7 @@ vw* parse_args(int argc, char *argv[])
parse_regressor_args(*all, vm, io_temp);
int temp_argc = 0;
- char** temp_argv = VW::get_argv_from_string(all->file_options.str(), temp_argc);
+ char** temp_argv = VW::get_argv_from_string(all->file_options->str(), temp_argc);
add_to_args(*all, temp_argc, temp_argv);
for (int i = 0; i < temp_argc; i++)
free(temp_argv[i]);
@@ -1032,7 +1032,7 @@ vw* parse_args(int argc, char *argv[])
po::store(pos, vm);
po::notify(vm);
- all->file_options.str("");
+ all->file_options->str("");
parse_feature_tweaks(*all, vm); //feature tweaks
@@ -1095,14 +1095,14 @@ vw* parse_args(int argc, char *argv[])
}
namespace VW {
- void cmd_string_replace_value( std::stringstream& ss, string flag_to_replace, string new_value )
+ void cmd_string_replace_value( std::stringstream*& ss, string flag_to_replace, string new_value )
{
flag_to_replace.append(" "); //add a space to make sure we obtain the right flag in case 2 flags start with the same set of characters
- string cmd = ss.str();
+ string cmd = ss->str();
size_t pos = cmd.find(flag_to_replace);
if( pos == string::npos )
//flag currently not present in command string, so just append it to command string
- ss << " " << flag_to_replace << new_value;
+ *ss << " " << flag_to_replace << new_value;
else {
//flag is present, need to replace old value with new value
@@ -1118,7 +1118,7 @@ namespace VW {
else
//replace characters between pos and pos_after_value by new_value
cmd.replace(pos,pos_after_value-pos,new_value);
- ss.str(cmd);
+ ss->str(cmd);
}
}
@@ -1173,7 +1173,7 @@ namespace VW {
{
finalize_regressor(all, all.final_regressor_name);
all.l->finish();
- delete all.l;
+ free_it(all.l);
if (all.reg.weight_vector != NULL)
free(all.reg.weight_vector);
free_parser(all);
@@ -1182,6 +1182,7 @@ namespace VW {
all.p->parse_name.delete_v();
free(all.p);
free(all.sd);
+ delete all.file_options;
for (size_t i = 0; i < all.final_prediction_sink.size(); i++)
if (all.final_prediction_sink[i] != 1)
io_buf::close_file_or_socket(all.final_prediction_sink[i]);
diff --git a/vowpalwabbit/parse_regressor.cc b/vowpalwabbit/parse_regressor.cc
index daee30da..def3a8de 100644
--- a/vowpalwabbit/parse_regressor.cc
+++ b/vowpalwabbit/parse_regressor.cc
@@ -229,16 +229,16 @@ void save_load_header(vw& all, io_buf& model_file, bool read, bool text)
"", read,
"\n",1, text);
- text_len = sprintf(buff, "options:%s\n", all.file_options.str().c_str());
- uint32_t len = (uint32_t)all.file_options.str().length()+1;
- memcpy(buff2, all.file_options.str().c_str(),len);
+ text_len = sprintf(buff, "options:%s\n", all.file_options->str().c_str());
+ uint32_t len = (uint32_t)all.file_options->str().length()+1;
+ memcpy(buff2, all.file_options->str().c_str(),len);
if (read)
len = buf_size;
bin_text_read_write(model_file,buff2, len,
"", read,
buff, text_len, text);
if (read)
- all.file_options.str(buff2);
+ all.file_options->str(buff2);
}
}
@@ -348,7 +348,7 @@ void parse_mask_regressor_args(vw& all, po::variables_map& vm){
}
} else {
// If no initial regressor, just clear out the options loaded from the header.
- all.file_options.str("");
+ all.file_options->str("");
}
}
}
diff --git a/vowpalwabbit/scorer.cc b/vowpalwabbit/scorer.cc
index cb04d091..58607b47 100644
--- a/vowpalwabbit/scorer.cc
+++ b/vowpalwabbit/scorer.cc
@@ -67,13 +67,13 @@ namespace Scorer {
}
else if (link.compare("logistic") == 0)
{
- all.file_options << " --link=logistic ";
+ *all.file_options << " --link=logistic ";
l.set_learn(predict_or_learn<true, logistic> );
l.set_predict(predict_or_learn<false, logistic>);
}
else if (link.compare("glf1") == 0)
{
- all.file_options << " --link=glf1 ";
+ *all.file_options << " --link=glf1 ";
l.set_learn(predict_or_learn<true, glf1>);
l.set_predict(predict_or_learn<false, glf1>);
}
diff --git a/vowpalwabbit/search.cc b/vowpalwabbit/search.cc
index c482541b..a702f348 100644
--- a/vowpalwabbit/search.cc
+++ b/vowpalwabbit/search.cc
@@ -1653,7 +1653,7 @@ namespace Search {
template<class T> void check_option(T& ret, vw&all, po::variables_map& vm, const char* opt_name, bool default_to_cmdline, bool(*equal)(T,T), const char* mismatch_error_string, const char* required_error_string) {
if (vm.count(opt_name)) {
ret = vm[opt_name].as<T>();
- all.file_options << " --" << opt_name << " " << ret;
+ *all.file_options << " --" << opt_name << " " << ret;
} else if (strlen(required_error_string)>0) {
std::cerr << required_error_string << endl;
if (! vm.count("help"))
@@ -1664,7 +1664,7 @@ namespace Search {
void check_option(bool& ret, vw&all, po::variables_map& vm, const char* opt_name, bool default_to_cmdline, const char* mismatch_error_string) {
if (vm.count(opt_name)) {
ret = true;
- all.file_options << " --" << opt_name;
+ *all.file_options << " --" << opt_name;
} else
ret = false;
}
diff --git a/vowpalwabbit/stagewise_poly.cc b/vowpalwabbit/stagewise_poly.cc
index 03a4a85f..91f1ca44 100644
--- a/vowpalwabbit/stagewise_poly.cc
+++ b/vowpalwabbit/stagewise_poly.cc
@@ -696,7 +696,7 @@ namespace StagewisePoly
poly.next_batch_sz = poly.batch_sz;
//following is so that saved models know to load us.
- all.file_options << " --stage_poly";
+ *all.file_options << " --stage_poly";
learner<stagewise_poly>& l = init_learner(&poly, all.l);
l.set_learn(learn);
diff --git a/vowpalwabbit/vw.h b/vowpalwabbit/vw.h
index 49bfaca3..0fa4ee77 100644
--- a/vowpalwabbit/vw.h
+++ b/vowpalwabbit/vw.h
@@ -18,7 +18,7 @@ namespace VW {
*/
vw* initialize(string s);
- void cmd_string_replace_value( std::stringstream& ss, string flag_to_replace, string new_value );
+ void cmd_string_replace_value( std::stringstream*& ss, string flag_to_replace, string new_value );
char** get_argv_from_string(string s, int& argc);