Skip to content

Commit

Permalink
Weighting weights makes no sense after all. Also eigen has more unuse…
Browse files Browse the repository at this point in the history
…d typedefs.
  • Loading branch information
kpu committed Jun 16, 2015
1 parent b48771e commit ea08103
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lm/interpolate/tune_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
#include "lm/interpolate/tune_instance.hh"
#include "util/file.hh"

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-local-typedefs"
#include <Eigen/Dense>
#pragma GCC diagnostic pop
#include <boost/program_options.hpp>

#include <cmath>
Expand All @@ -20,7 +23,7 @@ void TuneWeights(int tune_file, const std::vector<StringPiece> &model_names, Vec
for (std::size_t iteration = 0; iteration < 10 /*TODO fancy stopping criteria */; ++iteration) {
std::cerr << "Iteration " << iteration << ": weights =";
for (Vector::Index i = 0; i < weights.rows(); ++i) {
std::cerr << ' ' << (weights(i) * M_LN10);
std::cerr << ' ' << weights(i);
}
std::cerr << std::endl;
std::cerr << "Perplexity = " <<
Expand All @@ -29,8 +32,6 @@ void TuneWeights(int tune_file, const std::vector<StringPiece> &model_names, Vec
// TODO: 1.0 step size was too big and it kept getting unstable. More math.
weights -= 0.7 * hessian.inverse() * gradient;
}
// Internally converted to ln, which is equivalent to upweighting.
weights *= M_LN10;
}
}} // namespaces

Expand Down

0 comments on commit ea08103

Please sign in to comment.