mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-12-26 13:23:25 +03:00
Fix a mistake in a previous commit: tuning on a subset of features.
In the commit 4b6232b757
,
I thought I had fixed the bug around the tuning on a subset of
features by checking whether pdim and the length of the
active features which you want to optimize in the tuning.
However, it was wrong. I should set Point::optindices
appropriately according to specified the subset.
This commit is contained in:
parent
c3bb4c7abd
commit
6d6fb4383d
@ -38,6 +38,7 @@ Point::Point(const vector<parameter_t>& init,
|
||||
}
|
||||
} else {
|
||||
CHECK(init.size()==pdim);
|
||||
CHECK(optindices.size() == Point::dim);
|
||||
for (unsigned int i=0; i<Point::dim; i++) {
|
||||
operator[](i)=init[optindices[i]];
|
||||
m_min[i] = min[optindices[i]];
|
||||
|
@ -60,6 +60,15 @@ public:
|
||||
static void setdim(size_t d) {
|
||||
dim = d;
|
||||
}
|
||||
|
||||
static void set_optindices(const vector<unsigned int>& indices) {
|
||||
optindices = indices;
|
||||
}
|
||||
|
||||
static const vector<unsigned int>& get_optindices() {
|
||||
return optindices;
|
||||
}
|
||||
|
||||
static bool OptimizeAll() {
|
||||
return fixedweights.empty();
|
||||
}
|
||||
|
@ -362,13 +362,6 @@ int main(int argc, char **argv)
|
||||
vector<string> features;
|
||||
Tokenize(option.to_optimize_str.c_str(), ',', &features);
|
||||
|
||||
if (option.pdim != static_cast<int>(features.size())) {
|
||||
cerr << "Error: pdim and the specified number of features are not equal: "
|
||||
<< "pdim = " << option.pdim
|
||||
<< ", the number of features = " << features.size() << endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
for (vector<string>::const_iterator it = features.begin();
|
||||
it != features.end(); ++it) {
|
||||
const int feature_index = data.getFeatureIndex(*it);
|
||||
@ -405,6 +398,7 @@ int main(int argc, char **argv)
|
||||
|
||||
Point::setpdim(option.pdim);
|
||||
Point::setdim(to_optimize.size());
|
||||
Point::set_optindices(to_optimize);
|
||||
|
||||
//starting points consist of specified points and random restarts
|
||||
vector<Point> startingPoints;
|
||||
|
Loading…
Reference in New Issue
Block a user