hstatistics 0.2.0.3 → 0.2.0.4
raw patch · 3 files changed
+8/−7 lines, 3 filesdep ~hmatrix-gsl-stats
Dependency ranges changed: hmatrix-gsl-stats
Files
- CHANGES +3/−0
- hstatistics.cabal +2/−2
- lib/Numeric/Statistics/Shannon.hs +3/−5
CHANGES view
@@ -25,3 +25,6 @@ 0.2.0.3: added mutual_information to Numeric.Statistics.Shannon++0.2.0.4:+ fixed definition of mutual_information
hstatistics.cabal view
@@ -1,5 +1,5 @@ Name: hstatistics-Version: 0.2.0.3+Version: 0.2.0.4 License: GPL License-file: LICENSE Copyright: (c) A.V.H. McPhail 2010@@ -22,7 +22,7 @@ library Build-Depends: base >= 3 && < 5,- hmatrix >= 0.9.3, hmatrix-gsl-stats >= 0.1.0.2+ hmatrix >= 0.9.3, hmatrix-gsl-stats >= 0.1.1.3 Extensions:
lib/Numeric/Statistics/Shannon.hs view
@@ -27,16 +27,14 @@ import Numeric.LinearAlgebra.Algorithms import Numeric.LinearAlgebra.Interface() -import Prelude hiding (sum)--sum x = dot x (constant 1.0 (dim x))+--import Prelude hiding (sum) -- | the entropy \sum p_i l\ln{p_i} of a sequence entropy :: H.Histogram -- the underlying distribution -> Vector Double -- the sequence (expected to fall within bounds of Histogram) -> Double -- the entropy entropy p x = let ps = H.prob p x- in sum (ps * log ps) + in dot ps (log ps) -- | the mutuaal information \sum_x \sum_y \ln{\frac{p(x,y)}{p(x)p(y)}} mutual_information :: H2.Histogram2D -- the underlying distribution@@ -47,4 +45,4 @@ mutual_information p px py z@(x,y) = let ps = H2.prob p z xs = H.prob px x ys = H.prob py y- in sum $ log (ps/(xs*ys)) + in dot ps (log (ps/(xs*ys)))