haskseg-0.1.0.3: Simple unsupervised segmentation model

Safe HaskellNone
LanguageHaskell2010

Text.HaskSeg.Model

Synopsis

Documentation

oneWordProb :: (Show p, MonadLog (WithSeverity String) m, Probability p, Show elem, Ord elem) => Counts elem -> p -> p -> p -> p -> Int -> Morph elem -> m p Source #

Compute the log-probability of generating the given word n times, based on counts

g :: (Show p, MonadLog (WithSeverity String) m, Ord elem, Show elem, Probability p) => Counts elem -> p -> p -> p -> Morph elem -> Morph elem -> p -> Int -> Int -> m p Source #

Compute the log-probability of setting a single set of m sites, out of n, to positive

distribution :: (Show p, MonadLog (WithSeverity String) m, Probability p, Show elem, Ord elem, Show p) => Counts elem -> p -> p -> p -> Morph elem -> Morph elem -> p -> Int -> m (Vector p) Source #

Compute the log-categorical distribution of possible number of sites to set to positive: P(m) = (n choose m) * g(m)

sampleSite :: (Probability p, Categorical p, Show p, MonadIO m, MonadLog (WithSeverity String) m, MonadRandom m, MonadState (SamplingState Char) m, MonadReader (Params p) m) => Set Int -> m (Set Int) Source #

Randomly sample a site from those currently available, and then block-sample all compatible sites, returning the updated list of available sites

sample :: (Probability p, Categorical p, Show p, MonadIO m, MonadRandom m, MonadReader (Params p) m, MonadState (SamplingState Char) m, MonadLog (WithSeverity String) m) => Int -> m () Source #

Run one sampling iteration

fromState :: (MonadLog (WithSeverity String) m, Ord elem, Show elem, Probability p) => (Params p, Locations elem) -> Maybe [elem] -> m (Model p elem) Source #