summaryrefslogtreecommitdiff
path: root/training/mira
diff options
context:
space:
mode:
authorMichael Denkowski <mdenkows@cs.cmu.edu>2013-09-17 12:46:02 -0700
committerMichael Denkowski <mdenkows@cs.cmu.edu>2013-09-17 12:46:02 -0700
commit769dfa1e69c22d4aea37840a955db7fd2cf3a4d7 (patch)
tree0f7cad7c0bb484af673e583c9906cfa6a2e09a10 /training/mira
parent895dfd64ea5599ab16981cbfb538ec5f4073c8c1 (diff)
Save/load weights in stream mira
Diffstat (limited to 'training/mira')
-rw-r--r--training/mira/kbest_cut_mira.cc15
1 files changed, 14 insertions, 1 deletions
diff --git a/training/mira/kbest_cut_mira.cc b/training/mira/kbest_cut_mira.cc
index a9a4aeb6..59fa860a 100644
--- a/training/mira/kbest_cut_mira.cc
+++ b/training/mira/kbest_cut_mira.cc
@@ -745,10 +745,23 @@ int main(int argc, char** argv) {
delim = buf.find(" ||| ");
ds->update(buf.substr(delim + 5));
buf = buf.substr(0, delim);
+ } else if (cmd == "WEIGHTS") {
+ // WEIGHTS ||| WRITE
+ if (buf == "WRITE") {
+ cout << Weights::GetString(dense_weights) << endl;
+ // WEIGHTS ||| f1=w1 f2=w2 ...
+ } else {
+ Weights::UpdateFromString(buf, dense_weights);
+ }
+ continue;
+ } else {
+ cerr << "Error: cannot parse command, skipping line:" << endl;
+ cerr << cmd << " ||| " << buf << endl;
+ continue;
}
- // TODO: additional commands
}
}
+ // Regular mode or LEARN line from stream mode
//TODO: allow batch updating
lambdas.init_vector(&dense_weights);
dense_w_local = dense_weights;