crf-chain1-constrained-0.3.0: First-order, constrained, linear-chain conditional random fields

Safe HaskellNone

Data.CRF.Chain1.Constrained.Train

Contents

Synopsis

Model

data CRF a b Source

A conditional random field model with additional codec used for data encoding.

Constructors

CRF 

Fields

codec :: Codec a b

The codec is used to transform data into internal representation, where each observation and each label is represented by a unique integer number.

model :: Model

The actual model, which is a map from Features to potentials.

Instances

(Ord a, Ord b, Binary a, Binary b) => Binary (CRF a b) 

Training

trainSource

Arguments

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

Args for SGD

-> Bool

Store dataset on a disk

-> ([SentL a b] -> Set b)

R0 construction

-> (AVec Lb -> [(Xs, Ys)] -> [Feature])

Feature selection

-> 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.

The resulting model will contain features extracted with the user supplied extraction function. You can use the functions provided by the Data.CRF.Chain1.Constrained.Feature.Present and Data.CRF.Chain1.Constrained.Feature.Hidden modules for this purpose.

You also have to supply R0 construction method (e.g. oovChosen) which determines the contents of the default set of labels.

R0 construction

oovChosen :: Ord b => [SentL a b] -> Set bSource

Collect labels assigned to OOV words.

anyChosen :: Ord b => [SentL a b] -> Set bSource

Collect labels assigned to words in a dataset.

anyInterps :: Ord b => [SentL a b] -> Set bSource

Collect interpretations (also labels assigned) of words in a dataset.