packages feed

sequor 0.3.0 → 0.3.1

raw patch · 3 files changed

+8/−7 lines, 3 files

Files

sequor.cabal view
@@ -1,5 +1,5 @@ Name:                sequor-Version:             0.3.0+Version:             0.3.1 Description:         A sequence labeler based on Collins's sequence perceptron. Synopsis:	     A sequence labeler based on Collins's sequence perceptron. Homepage:	     http://code.google.com/p/sequor/
src/Hashable.hs view
@@ -37,13 +37,13 @@     -- | The computed 'hash' value should be as collision-free as possible, the     -- probability of @'hash' a == 'hash' b@ should ideally be 1 over the     -- number of representable values in the result type.-    hash :: Bits b => a -> b+    hash :: (Num b, Bits b) => a -> b  -- | Combines two given hash values.-combine :: (Bits b) => b -> b -> b+combine :: (Num b, Bits b) => b -> b -> b combine h1 h2 = (h1 + h1 `shiftL` 5) `xor` h2 -hashAndCombine :: (Bits b,Hashable h) => b -> h -> b+hashAndCombine :: (Num b, Bits b, Hashable h) => b -> h -> b hashAndCombine acc h = acc `combine` hash h  instance Hashable () where hash _ = 0
src/Perceptron/Sequence.hs view
@@ -13,6 +13,7 @@     ) where +import qualified Data.Array.Unsafe as AU import Data.Array.ST import Data.Array.Unboxed import qualified Data.Array as A@@ -186,7 +187,7 @@         -> ST s () iter opts _ ss (c,params,params_a) = do     for_ ss $ \ (x,y) -> do-      params' <- unsafeFreeze params+      params' <- AU.unsafeFreeze params       let (y',phi_xy') = decode' opts (params'`dot`) x       when (y' /= y) $ do          let phi_xy = phi opts x y @@ -211,8 +212,8 @@     for_ [1..oEpochs opts] $               \i -> do iter opts i ss (c,params,params_a)                       c' <- readSTRef c-                      params' <- unsafeFreeze params-                      params_a' <- unsafeFreeze params_a+                      params' <- AU.unsafeFreeze params+                      params_a' <- AU.unsafeFreeze params_a                       let w  = (fromIntegral c',params',params_a')                           ys xys = [ fst . decode' opts (w`dot'`) $ x                                              | (x,_) <- xys ]