diff options
author | John Langford <jl@hunch.net> | 2014-01-23 19:43:09 +0400 |
---|---|---|
committer | John Langford <jl@hunch.net> | 2014-01-23 19:43:09 +0400 |
commit | f9a6b9bd2f40abf378481ae6ca92966dfdae2d5e (patch) | |
tree | bec1fcf318c70d61fed8955a4482bf43aadbf177 /vowpalwabbit/global_data.cc | |
parent | 238040fb9f5cfd408ea97c4349e8df005481241a (diff) | |
parent | cb8d90352a0007c8b133f535ad0f9111c7a58cee (diff) |
reconcile
Diffstat (limited to 'vowpalwabbit/global_data.cc')
-rw-r--r-- | vowpalwabbit/global_data.cc | 30 |
1 files changed, 8 insertions, 22 deletions
diff --git a/vowpalwabbit/global_data.cc b/vowpalwabbit/global_data.cc index f500f478..bf109bbb 100644 --- a/vowpalwabbit/global_data.cc +++ b/vowpalwabbit/global_data.cc @@ -31,7 +31,7 @@ size_t really_read(int sock, void* in, size_t count) { if ((r = #ifdef _WIN32 - _read(sock,buf,(unsigned int)(count-done)) + recv(sock,buf,(unsigned int)(count-done),0) #else read(sock,buf,(unsigned int)(count-done)) #endif @@ -65,7 +65,7 @@ void send_prediction(int sock, global_prediction p) { if ( #ifdef _WIN32 - _write(sock, &p, sizeof(p)) + send(sock, reinterpret_cast<const char*>(&p), sizeof(p), 0) #else write(sock, &p, sizeof(p)) #endif @@ -106,11 +106,7 @@ void print_result(int f, float res, float weight, v_array<char> tag) print_tag(ss, tag); ss << '\n'; ssize_t len = ss.str().size(); -#ifdef _WIN32 - ssize_t t = _write(f, ss.str().c_str(), (unsigned int)len); -#else - ssize_t t = write(f, ss.str().c_str(), (unsigned int)len); -#endif + ssize_t t = io_buf::write_file_or_socket(f, ss.str().c_str(), (unsigned int)len); if (t != len) { cerr << "write error" << endl; @@ -128,11 +124,7 @@ void print_raw_text(int f, string s, v_array<char> tag) print_tag (ss, tag); ss << '\n'; ssize_t len = ss.str().size(); -#ifdef _WIN32 - ssize_t t = _write(f, ss.str().c_str(), (unsigned int)len); -#else - ssize_t t = write(f, ss.str().c_str(), (unsigned int)len); -#endif + ssize_t t = io_buf::write_file_or_socket(f, ss.str().c_str(), (unsigned int)len); if (t != len) { cerr << "write error" << endl; @@ -156,11 +148,7 @@ void active_print_result(int f, float res, float weight, v_array<char> tag) } ss << '\n'; ssize_t len = ss.str().size(); -#ifdef _WIN32 - ssize_t t = _write(f, ss.str().c_str(), (unsigned int)len); -#else - ssize_t t = write(f, ss.str().c_str(), (unsigned int)len); -#endif + ssize_t t = io_buf::write_file_or_socket(f, ss.str().c_str(), (unsigned int)len); if (t != len) cerr << "write error" << endl; } @@ -180,11 +168,8 @@ void print_lda_result(vw& all, int f, float* res, float weight, v_array<char> ta print_tag(ss, tag); ss << '\n'; ssize_t len = ss.str().size(); -#ifdef _WIN32 - ssize_t t = _write(f, ss.str().c_str(), (unsigned int)len); -#else - ssize_t t = write(f, ss.str().c_str(), (unsigned int)len); -#endif + ssize_t t = io_buf::write_file_or_socket(f, ss.str().c_str(), (unsigned int)len); + if (t != len) cerr << "write error" << endl; } @@ -253,6 +238,7 @@ vw::vw() lda_alpha = 0.1f; lda_rho = 0.1f; lda_D = 10000.; + lda_epsilon = 0.001; minibatch = 1; span_server = ""; m = 15; |