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:
Diffstat (limited to 'vowpalwabbit/global_data.cc')
-rw-r--r--vowpalwabbit/global_data.cc30
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;