summaryrefslogtreecommitdiff
path: root/minrisk/minrisk_optimize.cc
diff options
context:
space:
mode:
authorPatrick Simianer <simianer@cl.uni-heidelberg.de>2012-06-28 17:53:11 +0200
committerPatrick Simianer <simianer@cl.uni-heidelberg.de>2012-06-28 17:53:11 +0200
commitbace2961c909e2e4b1d35dff349fdbc9d02cb138 (patch)
treedd90368e7771dea72323962bbb0575c2497cb841 /minrisk/minrisk_optimize.cc
parent3c03e716a8638163a820dbecf652c772e6d651f2 (diff)
parentc84ef9590d11819b7f8441a53b1699a912d949e1 (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";