packages feed

mealy 0.1.0 → 0.2.0

raw patch · 2 files changed

+21/−25 lines, 2 filesdep +optics-coredep −generic-lensdep −lensdep ~numhaskdep ~numhask-arrayPVP ok

version bump matches the API change (PVP)

Dependencies added: optics-core

Dependencies removed: generic-lens, lens

Dependency ranges changed: numhask, numhask-array

API changes (from Hackage documentation)

Files

mealy.cabal view
@@ -1,26 +1,27 @@ cabal-version: 2.4 name:          mealy-version:       0.1.0+version:       0.2.0 license:       BSD-3-Clause-copyright:     Tony Day (c) AfterTimes+copyright:     Tony Day (c) 2013 - 2022 maintainer:    tonyday567@gmail.com author:        Tony Day homepage:      https://github.com/tonyday567/mealy#readme bug-reports:   https://github.com/tonyday567/mealy/issues synopsis:      Mealy machines for processing time-series and ordered data.-description:   @mealy@ provides support for computing statistics (such as an average or a standard deviation)-     as current state. Usage is to supply a decay function representing the relative weights of recent values versus older ones, in the manner of exponentially-weighted averages. The library attempts to be polymorphic in the statistic which can be combined in applicative style.-    .-    == Usage-    .-    >>> import Mealy-    .-    >>> fold ((,) <$> ma 0.9 <*> std 0.9) [1..100]-    (91.00265621044142,9.472822805289121)+description:+  @mealy@ provides support for computing statistics (such as an average or a standard deviation)+  as current state. Usage is to supply a decay function representing the relative weights of recent values versus older ones, in the manner of exponentially-weighted averages. The library attempts to be polymorphic in the statistic which can be combined in applicative style.+  .+  == Usage+  .+  >>> import Mealy+  .+  >>> fold ((,) <$> ma 0.9 <*> std 0.9) [1..100]+  (91.00265621044142,9.472822805289121)  category:      folding build-type:    Simple-tested-with:   GHC ==8.8.4 || ==8.10.4 || ==9.0.1 || ==9.2.0.20210821+tested-with:   GHC ==8.8.4 || ==8.10.7 || ==9.2.1  source-repository head   type:     git@@ -37,19 +38,18 @@   ghc-options:     -Wall -Wcompat -Wincomplete-record-updates     -Wincomplete-uni-patterns -Wredundant-constraints -fwrite-ide-info-    -hiedir=.hie -Wunused-packages+    -hiedir=.hie    build-depends:     , adjunctions        ^>=4.4-    , base               >=4.13 && <5+    , base               >=4.13   && <5     , containers         ^>=0.6.2     , folds              ^>=0.7.6-    , generic-lens       ^>=2.2.0-    , lens               ^>=5.0.1     , matrix             ^>=0.3.6     , mwc-probability    ^>=2.3.1-    , numhask            ^>=0.8.1-    , numhask-array      ^>=0.9.1+    , numhask            ^>=0.10+    , numhask-array      ^>=0.10+    , optics-core        ^>=0.4     , primitive          ^>=0.7.2     , profunctors        ^>=5.6.2     , tdigest            ^>=0.2.1
src/Data/Mealy.hs view
@@ -71,12 +71,11 @@  import Control.Category import Control.Exception-import Control.Lens hiding (Empty, Unwrapped, Wrapped, index, (:>), (|>)) import Data.Fold hiding (M) import Data.Functor.Rep-import Data.Generics.Labels () import Data.List (scanl') import qualified Data.Matrix as M+import Data.Profunctor import Data.Sequence (Seq) import qualified Data.Sequence as Seq import Data.Text (Text)@@ -85,6 +84,7 @@ import qualified NumHask.Array.Fixed as F import NumHask.Array.Shape (HasShape) import NumHask.Prelude hiding (L1, asum, fold, id, (.))+import Optics.Core  -- $setup --@@ -213,7 +213,6 @@ -- Applicative-style exponentially-weighted standard deviation computation: -- -- > std r = (\s ss -> sqrt (ss - s ** 2)) <$> ma r <*> sqma r--- online :: (Divisive b, Additive b) => (a -> b) -> (b -> b) -> Mealy a b online f g = M intract step av   where@@ -232,7 +231,6 @@ -- -- >>> fold (ma 0.99) xs0 -- 9.713356299018187e-2--- ma :: (Divisive a, Additive a) => a -> Mealy a a ma r = online id (* r) {-# INLINEABLE ma #-}@@ -271,7 +269,6 @@ -- -- >>> fold (std 1) xs0 -- 1.0126438036262801--- std :: (Divisive a, ExpField a) => a -> Mealy a a std r = (\s ss -> sqrt (ss - s ** (one + one))) <$> ma r <*> sqma r {-# INLINEABLE std #-}@@ -510,7 +507,6 @@ -- >>> let xsb0 = fold (beta1 (ma (1 - 0.001))) $ drop 1 $ zip ma' xs0 -- >>> xsb - xsb0 -- 0.10000000000000009--- depState :: (a -> b -> a) -> Mealy a b -> Mealy a a depState f (M sInject sStep sExtract) = M inject step extract   where@@ -543,7 +539,7 @@ -- | Apply a model1 relationship using a single decay factor. -- -- >>> :set -XOverloadedLabels--- >>> import Control.Lens+-- >>> import Optics.Core -- >>> fold (depModel1 0.01 (zeroModel1 & #betaMa2X .~ 0.1)) xs0 -- -0.4591515493154126 depModel1 :: Double -> Model1 -> Mealy Double Double