crf-chain2-tiers-0.4.0: Second-order, tiered, constrained, linear conditional random fields

Safe HaskellNone
LanguageHaskell98

Data.CRF.Chain2.Tiers.DAG

Contents

Synopsis

CRF

data CRF a b Source #

CRF model data.

Constructors

CRF 

Fields

Instances
(Ord a, Ord b, Binary a, Binary b) => Binary (CRF a b) Source # 
Instance details

Defined in Data.CRF.Chain2.Tiers.DAG

Methods

put :: CRF a b -> Put #

get :: Get (CRF a b) #

putList :: [CRF a b] -> Put #

size :: CRF a b -> Int Source #

Compute size (number of features) of the model.

prune :: Double -> CRF a b -> CRF a b Source #

Discard model features with absolute values (in log-domain) lower than the given threshold.

Training

train Source #

Arguments

:: (Ord a, Ord b) 
=> Int

Number of layers (tiers)

-> FeatSel ()

Feature selection

-> SgdArgs

SGD parameters

-> Bool

Store dataset on a disk

-> IO [SentL a b]

Training data IO action

-> IO [SentL a b]

Evaluation data

-> IO (CRF a b)

Resulting model

Train the CRF using the stochastic gradient descent method.

Tagging

tag :: (Ord a, Ord b) => CRF a b -> Sent a b -> DAG () (Maybe [b]) Source #

Find the most probable labeled path.

marginals :: (Ord a, Ord b) => CRF a b -> Sent a b -> SentL a b Source #

Tag labels with marginal probabilities.

data ProbType Source #

Type of resulting probabilities.

Constructors

Marginals

Marginal probabilities

MaxProbs

TODO

probs :: (Ord a, Ord b) => ProbType -> CRF a b -> Sent a b -> SentL a b Source #

Tag labels with marginal probabilities.

Dataset

Feature selection

type FeatSel a = DAG a (X, Y) -> [Feat] Source #

A feature selection function type.

selectHidden :: FeatSel a Source #

The hiddenFeats adapted to fit feature selection specs.

selectPresent :: FeatSel a Source #

The presentFeats adapted to fit feature selection specs.