summaryrefslogtreecommitdiff
path: root/minrisk/minrisk_optimize.cc
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2012-06-27 15:58:53 +0200
committerPatrick Simianer <p@simianer.de>2012-06-27 15:58:53 +0200
commita2422421fbbaf20ad5dbe44a7ef84df53e0a3e76 (patch)
treed781ad897fc21333c4fc4646b8d42aea0d6681d4 /minrisk/minrisk_optimize.cc
parent55cafb1189cac406aa0e5c4fc7d8fd57da69c9a4 (diff)
parentb3a7f6c5d97acac3cd6b14de194eadaa18175fda (diff)
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'minrisk/minrisk_optimize.cc')
-rw-r--r--minrisk/minrisk_optimize.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/minrisk/minrisk_optimize.cc b/minrisk/minrisk_optimize.cc
index 5096acc1..6e651994 100644
--- a/minrisk/minrisk_optimize.cc
+++ b/minrisk/minrisk_optimize.cc
@@ -105,6 +105,13 @@ int main(int argc, char** argv) {
vector<weight_t> weights;
const string weightsf = conf["weights"].as<string>();
Weights::InitFromFile(weightsf, &weights);
+ double t = 0;
+ for (unsigned i = 0; i < weights.size(); ++i)
+ t += weights[i] * weights[i];
+ if (t > 0) {
+ for (unsigned i = 0; i < weights.size(); ++i)
+ weights[i] /= sqrt(t);
+ }
string line, file;
vector<training::CandidateSet> kis;
cerr << "Loading hypergraphs...\n";