diff options
| author | Chris Dyer <redpony@gmail.com> | 2009-12-03 16:49:30 -0500 | 
|---|---|---|
| committer | Chris Dyer <redpony@gmail.com> | 2009-12-03 16:49:30 -0500 | 
| commit | 9fae7b75c64f4dfb6e45ff8f2ec61b597f37d225 (patch) | |
| tree | 61a187c4fa6db8527f90f3060d18357f7b60b44a /vest/line_optimizer.h | |
| parent | 671c21451542e2dd20e45b4033d44d8e8735f87b (diff) | |
fix build in new layout
Diffstat (limited to 'vest/line_optimizer.h')
| -rw-r--r-- | vest/line_optimizer.h | 44 | 
1 files changed, 44 insertions, 0 deletions
| diff --git a/vest/line_optimizer.h b/vest/line_optimizer.h new file mode 100644 index 00000000..43164360 --- /dev/null +++ b/vest/line_optimizer.h @@ -0,0 +1,44 @@ +#ifndef LINE_OPTIMIZER_H_ +#define LINE_OPTIMIZER_H_ + +#include <vector> + +#include "error_surface.h" +#include "sampler.h" + +template <typename T> class SparseVector; +class Weights; + +struct LineOptimizer { + +  // use MINIMIZE_SCORE for things like TER, WER +  // MAXIMIZE_SCORE for things like BLEU +  enum ScoreType { MAXIMIZE_SCORE, MINIMIZE_SCORE }; + +  // merge all the error surfaces together into a global +  // error surface and find (the middle of) the best segment +  static double LineOptimize( +     const std::vector<ErrorSurface>& envs, +     const LineOptimizer::ScoreType type, +     float* best_score, +     const double epsilon = 1.0/65536.0); + +  // return a random vector of length 1 where all dimensions +  // not listed in dimensions will be 0. +  static void RandomUnitVector(const std::vector<int>& dimensions, +                               SparseVector<double>* axis, +                               RandomNumberGenerator<boost::mt19937>* rng); + +  // generate a list of directions to optimize; the list will +  // contain the orthogonal vectors corresponding to the dimensions in +  // primary and then additional_random_directions directions in those +  // dimensions as well.  All vectors will be length 1. +  static void CreateOptimizationDirections( +     const std::vector<int>& primary, +     int additional_random_directions, +     RandomNumberGenerator<boost::mt19937>* rng, +     std::vector<SparseVector<double> >* dirs); + +}; + +#endif | 
