packages feed

hstatistics 0.2.0.1 → 0.2.0.2

raw patch · 2 files changed

+6/−3 lines, 2 files

Files

hstatistics.cabal view
@@ -1,5 +1,5 @@ Name:               hstatistics-Version:            0.2.0.1+Version:            0.2.0.2 License:            GPL License-file:       LICENSE Copyright:          (c) A.V.H. McPhail 2010
lib/Numeric/Statistics/Shannon.hs view
@@ -29,10 +29,13 @@  sum x = dot x (constant  1 (dim x)) +prob p y = let Just y' = find p y +           in getBin p y'+ -- | the entropy \sum p_i l\ln{p_i} of a sequence entropy :: Histogram             -- the underlying distribution-        -> Vector Double         -- the sequence+        -> Vector Double         -- the sequence (expected to fall within bounds of Histogram)         -> Double                -- the entropy-entropy p x = let ps = mapVector (\y -> let Just y' = find p y in getBin p y') x+entropy p x = let ps = mapVector (prob p) x               in sum (ps * log ps)