From: Michael Andreen Date: Thu, 21 Jun 2007 12:46:22 +0000 (+0000) Subject: ModelIdentifier::identify implemented and passes test X-Git-Tag: v0.1~54 X-Git-Url: https://ruin.nu/git/?p=germs.git;a=commitdiff_plain;h=5cdc3cbecb3bed52346f262dc8d0d0c88e8dba17 ModelIdentifier::identify implemented and passes test --- diff --git a/src/modelidentifier.cpp b/src/modelidentifier.cpp index 561eea3..98fae9b 100644 --- a/src/modelidentifier.cpp +++ b/src/modelidentifier.cpp @@ -45,8 +45,44 @@ std::map ModelIdentifier::identify(const GeneOrde else ++neg; } + double length = go.size(); + vector input(8); + input[0] = pos/length; + input[1] = neg/length; + + pair seqs = longestSequences(go); + + input[2] = seqs.first/length; + input[3] = seqs.second/length; + + double cycles = countCycles(go); + input[4] = cycles/length; + + vector comps = findComponents(go); + + pos = 0; + neg = 0; + int un = 0; + for (vector::iterator c = comps.begin(); c != comps.end(); ++c){ + if (c->sign > 0) + ++pos; + else if (c->sign < 0) + ++neg; + else + ++un; + } + + input[5] = un/cycles; + input[6] = pos/cycles; + input[7] = neg/cycles; + + double *output = fann_run(_ann,&input[0]); + map scores; - scores[X] = 1; - scores[Whirl] = -1; + scores[X] = output[0]; + scores[Zipper] = output[1]; + scores[Whirl] = output[2]; + scores[FatX] = output[3]; + scores[Cloud] = output[4]; return scores; }