Commit Graph

17 Commits

Author SHA1 Message Date
Hieu Hoang
39139e7a64 beautify. 2015-05-15 18:09:38 +01:00
Barry Haddow
e34db401ee Refactoring of weight loading, making it easier to test hg rescoring. 2015-05-13 10:21:43 +01:00
Jeroen Vermeulen
38d790cac0 Add cross-platform randomizer module.
The code uses two mechanisms for generating random numbers: srand()/rand(),
which is not thread-safe, and srandom()/random(), which is POSIX-specific.

Here I add a util/random.cc module that centralizes these calls, and unifies
some common usage patterns.  If the implementation is not good enough, we can
now change it in a single place.

To keep things simple, this uses the portable srand()/rand() but protects them
with a lock to avoid concurrency problems.

The hard part was to keep the regression tests passing: they rely on fixed
sequences of random numbers, so a small code change could break them very
thoroughly.  Util::rand(), for wide types like size_t, calls std::rand() not
once but twice.  This behaviour was generalized into utils::wide_rand() and
friends.
2015-04-23 23:46:04 +07:00
Hieu Hoang
05ead45e71 beautify 2015-01-14 11:07:42 +00:00
Michael Denkowski
44b22ece69 More streaming for kbmira 2014-09-30 14:50:10 -04:00
Rico Sennrich
3d00e5dc8c basic support for more metrics with kbmira
metrics need getReferenceLength (for background smoothing) to work with kbmira
2014-09-22 10:49:20 +01:00
Barry Haddow
ff188c454a Sparse features trainable with hg mira
(In phrase-based Moses)
2014-08-06 11:38:51 +01:00
Barry Haddow
efee2695c3 Merge 08811deb17337356cd8dae9c59c0160590679a35 from joshua 2014-07-21 11:04:43 +01:00
Hieu Hoang
6249432407 beautify 2013-05-29 18:16:15 +01:00
Colin Cherry
3fa95c022b Addad a "--safe-hope" option to kbmira.
This will limit the influence of model score on oracle (hope) selection.
Good for cases whith extremely large feature values. May make it the defult.
2012-09-14 13:58:28 -04:00
Colin Cherry
662e7e7f64 As requested by my bosses: added NRC copyright to kbmira. 2012-07-10 13:13:50 -04:00
Hieu Hoang
b5aa04feb7 compile error 2012-07-02 10:23:26 +01:00
Colin Cherry
58c3280c2c HypPackEnumerator now stores MiraFeatureVectors, as opposed to
FeatureDataItems. Uses roughly half the memory.
2012-06-26 17:02:32 -04:00
Colin Cherry
32299593fa Added debugging info to kbmira. 2012-06-26 16:29:20 -04:00
Colin Cherry
a8a5f896db Fixed some bugs in BatchMira's sparse feature handling. 2012-06-14 14:09:06 -04:00
Tetsuo Kiso
2599ef6dc3 Bug fix: kbmira failed to load dense weights. 2012-06-09 18:03:12 +09:00
Colin Cherry
fd577d7a65 Batch k-best MIRA is written and integrated into mert-moses.pl
Regression tests all check out, and kbmira seems to work fine
on a Hansard French->English task.

HypPackEnumerator class may be of interest to pro.cpp and future
optimizers, as it abstracts a lot of the boilerplate involved in
enumerating multiple k-best lists.

MiraWeightVector is not really mira-specific - just a weight vector
that enables efficient averaging. Could be useful to a perceptron
as well. Same goes for MiraFeatureVector.

Interaction with sparse features is written, but untested.
2012-05-29 13:38:57 -04:00