X-Git-Url: https://ruin.nu/git/?p=germs.git;a=blobdiff_plain;f=src%2Fmodelidentifier.cpp;h=98fae9bbc48c2261dec4648efd6edb3b4733a435;hp=561eea3741462986cf08bfac8119a4c643f90bd7;hb=5cdc3cbecb3bed52346f262dc8d0d0c88e8dba17;hpb=868e1b08fbbd49e489dc1349cb3657521c5c1dd9 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; }