From eeacfad4f663dc5179a2791eb57aec540a9f1ed5 Mon Sep 17 00:00:00 2001 From: Stefan Dresselhaus Date: Thu, 7 Jun 2018 12:15:07 +0200 Subject: [PATCH] forgot file. --- src/Evaluation.hs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/Evaluation.hs diff --git a/src/Evaluation.hs b/src/Evaluation.hs new file mode 100644 index 0000000..fc8deaf --- /dev/null +++ b/src/Evaluation.hs @@ -0,0 +1,20 @@ +module Evaluation ( varianceOfProducedCompounds + , meanOfDistinctCompounds + ) where + +import Control.Foldl as F +import Numeric.LinearAlgebra as LA + +import Environment + +eps :: Amount +eps = 0.01 + +varianceOfProducedCompounds :: [LA.Vector Amount] -> Double +varianceOfProducedCompounds comps = F.fold F.variance $ sumElements <$> comps + +-- | count compound as active if it is over eps. +meanOfDistinctCompounds :: [LA.Vector Amount] -> Double +meanOfDistinctCompounds comps = F.fold F.mean $ sumElements . LA.cmap (\x -> if abs x < eps then 0 else 1) <$> comps + +-- TODO: Mean enzyme-activity?