packages feed

dirichlet 0.1.0.5 → 0.1.0.6

raw patch · 5 files changed

+16/−12 lines, 5 filessetup-changedPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

ChangeLog.md view
@@ -5,6 +5,11 @@ ## Unreleased changes  +## 0.1.0.6++-   Tooling.++ ## 0.1.0.5  -   Minor changes; tooling; Nix support.
− Setup.hs
@@ -1,2 +0,0 @@-import Distribution.Simple-main = defaultMain
dirichlet.cabal view
@@ -1,6 +1,6 @@-cabal-version:       2.4+cabal-version:       3.0 name:                dirichlet-version:             0.1.0.5+version:             0.1.0.6 synopsis:            Multivariate Dirichlet distribution description:         Please see the README on GitHub at <https://github.com/dschrempf/dirichlet#readme> homepage:            https://github.com/dschrempf/dirichlet
src/Statistics/Distribution/Dirichlet.hs view
@@ -60,9 +60,9 @@ dirichletDistribution :: V.Vector Double -> Either String DirichletDistribution dirichletDistribution v   | V.length v < 2 =-    Left "dirichletDistribution: Parameter vector is too short."+      Left "dirichletDistribution: Parameter vector is too short."   | isNegativeOrZero v =-    Left "dirichletDistribution: One or more parameters are negative or zero."+      Left "dirichletDistribution: One or more parameters are negative or zero."   | otherwise = Right $ DirichletDistribution v (V.length v) (invBeta v)  -- Tolerance.@@ -125,9 +125,9 @@ dirichletDistributionSymmetric :: Int -> Double -> Either String DirichletDistributionSymmetric dirichletDistributionSymmetric k a   | k < 2 =-    Left "dirichletDistributionSymmetric: The dimension is smaller than two."+      Left "dirichletDistributionSymmetric: The dimension is smaller than two."   | a <= 0 =-    Left "dirichletDistributionSymmetric: The parameter is negative or zero."+      Left "dirichletDistributionSymmetric: The parameter is negative or zero."   | otherwise = Right $ DirichletDistributionSymmetric a k (invBetaSym k a)  -- | Density of the symmetric Dirichlet distribution evaluated at a given value
test/Statistics/Distribution/DirichletSpec.hs view
@@ -19,8 +19,8 @@ import qualified Data.Vector.Unboxed as V import Numeric.Log hiding (sum) import Statistics.Distribution.Dirichlet-import Test.Hspec import System.Random.MWC+import Test.Hspec  eps :: Double eps = 1e-14@@ -40,7 +40,8 @@ -- Extract means. xbar :: Int -> [V.Vector Double] -> Double xbar n xss = sum xs / fromIntegral (length xs)-  where xs = map (V.! n) xss+  where+    xs = map (V.! n) xss  spec :: Spec spec = do@@ -72,9 +73,9 @@       xs <- replicateM 1000 (dirichletSample ddSym10 g)       map V.length xs `shouldBe` replicate 1000 10       -- print [ xbar i xs | i <- [0..9]]-      [ abs (xbar i xs - 0.1) > 0.01 | i <- [0..9]] `shouldBe` replicate 10 False+      [abs (xbar i xs - 0.1) > 0.01 | i <- [0 .. 9]] `shouldBe` replicate 10 False       xs' <- replicateM 1000 (dirichletSample dd10 g)       map V.length xs' `shouldBe` replicate 1000 10       -- print [ xbar i xs | i <- [0..9]]       let aSum = V.sum alphas10-      [ abs (xbar i xs' - (alphas10 V.! i / aSum)) > 0.01 | i <- [0..9]] `shouldBe` replicate 10 False+      [abs (xbar i xs' - (alphas10 V.! i / aSum)) > 0.01 | i <- [0 .. 9]] `shouldBe` replicate 10 False