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

Safe HaskellNone
LanguageHaskell2010

Data.CRF.Chain1.Model

Description

Internal implementation of the CRF model.

Synopsis

Documentation

newtype FeatIx Source #

A feature index. To every model feature a unique index is assigned.

Constructors

FeatIx 

Fields

Instances
Eq FeatIx Source # 
Instance details

Defined in Data.CRF.Chain1.Model

Methods

(==) :: FeatIx -> FeatIx -> Bool #

(/=) :: FeatIx -> FeatIx -> Bool #

Ord FeatIx Source # 
Instance details

Defined in Data.CRF.Chain1.Model

Show FeatIx Source # 
Instance details

Defined in Data.CRF.Chain1.Model

Binary FeatIx Source # 
Instance details

Defined in Data.CRF.Chain1.Model

Methods

put :: FeatIx -> Put #

get :: Get FeatIx #

putList :: [FeatIx] -> Put #

Unbox FeatIx Source # 
Instance details

Defined in Data.CRF.Chain1.Model

Vector Vector FeatIx Source # 
Instance details

Defined in Data.CRF.Chain1.Model

MVector MVector FeatIx Source # 
Instance details

Defined in Data.CRF.Chain1.Model

newtype Vector FeatIx Source # 
Instance details

Defined in Data.CRF.Chain1.Model

newtype MVector s FeatIx Source # 
Instance details

Defined in Data.CRF.Chain1.Model

data Model Source #

The model is realy a map from features to potentials, but for the sake of efficiency the internal representation is more complex.

Constructors

Model 

Fields

  • values :: Vector Double

    Value (potential) of the model for feature index.

  • ixMap :: Map Feature FeatIx

    A map from features to feature indices

  • lbNum :: Int

    Number of labels. The label set is of the {0, 1, .., lbNum - 1} form, which is guaranteed by the codec.

  • sgIxsV :: Vector FeatIx

    Singular feature index for the given label. Index is equall to -1 if feature is not present in the model.

  • obIxsV :: Vector (Vector LbIx)

    Set of labels for the given observation which, together with the observation, constitute an observation feature of the model.

  • prevIxsV :: Vector (Vector LbIx)

    Set of ,,previous'' labels for the value of the ,,current'' label. Both labels constitute a transition feature present in the the model.

  • nextIxsV :: Vector (Vector LbIx)

    Set of ,,next'' labels for the value of the ,,current'' label. Both labels constitute a transition feature present in the the model.

Instances
Binary Model Source # 
Instance details

Defined in Data.CRF.Chain1.Model

Methods

put :: Model -> Put #

get :: Get Model #

putList :: [Model] -> Put #

mkModel :: [Feature] -> Model Source #

Construct the model from the list of features. All parameters will be set to 0. There may be repetitions in the input list.

lbSet :: Model -> [Lb] Source #

List of labels [0 .. lbNum - 1].

valueL :: Model -> FeatIx -> LogFloat Source #

Model potential defined for the given feature interpreted as a number in logarithmic domain.

featToIx :: Model -> Feature -> FeatIx Source #

Determine the index for the given feature.

featToInt :: Model -> Feature -> Int Source #

Same as featToIx but immediately unwrap the feature index to integer value.

sgValue :: Model -> Lb -> LogFloat Source #

Potential value (in log domain) of the singular feature with the given label. The value defaults to 0 when the feature is not a member of the model.

sgIxs :: Model -> [LbIx] Source #

List of labels which can be located on the first position of a sentence together with feature indices determined by them.

obIxs :: Model -> Ob -> [LbIx] Source #

List of labels which constitute a valid feature in combination with the given observation accompanied by feature indices determined by these labels.

nextIxs :: Model -> Lb -> [LbIx] Source #

List of ,,next'' labels which constitute a valid feature in combination with the ,,current'' label accompanied by feature indices determined by ,,next'' labels.

prevIxs :: Model -> Lb -> [LbIx] Source #

List of ,,previous'' labels which constitute a valid feature in combination with the ,,current'' label accompanied by feature indices determined by ,,previous'' labels.