crf-chain2-generic-0.1.0: Second-order, generic, constrained, linear conditional random fields

Safe HaskellNone

Data.CRF.Chain2.Generic.Model

Synopsis

Documentation

newtype FeatIx Source

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

Constructors

FeatIx 

Fields

unFeatIx :: Int
 

data FeatGen o t f Source

Feature generation specification.

Constructors

FeatGen 

Fields

obFeats :: o -> t -> [f]
 
trFeats1 :: t -> [f]
 
trFeats2 :: t -> t -> [f]
 
trFeats3 :: t -> t -> t -> [f]
 

data Model o t f Source

A conditional random field.

Constructors

Model 

Fields

values :: Vector Double
 
ixMap :: Map f FeatIx
 
featGen :: FeatGen o t f
 

mkModel :: Ord f => FeatGen o t f -> [Xs o t] -> Model o t fSource

FINISH: Dodać ekstrację liczby cech ze zbioru danych, zmienić funkcję mkModel.

data Core f Source

A core of the model with no feature generation function. Unlike the Model, the core can be serialized.

Constructors

Core 

Instances

(Ord f, Binary f) => Binary (Core f) 

core :: Model o t f -> Core fSource

Extract the model core.

withCore :: Core f -> FeatGen o t f -> Model o t fSource

Construct model with the given core and feature generation function.

phi :: Ord f => Model o t f -> f -> LogFloatSource

Potential assigned to the feature -- exponential of the corresonding parameter.

index :: Ord f => Model o t f -> f -> Maybe FeatIxSource

Index of the feature.

presentFeats :: FeatGen o t f -> Xs o t -> Ys t -> [(f, LogFloat)]Source

Features present in the dataset element together with corresponding occurence probabilities.

hiddenFeats :: FeatGen o t f -> Xs o t -> [f]Source

Features hidden in the dataset element.

obFeatsOn :: FeatGen o t f -> Xs o t -> Int -> LbIx -> [f]Source

trFeatsOn :: FeatGen o t f -> Xs o t -> Int -> LbIx -> LbIx -> LbIx -> [f]Source

onWord :: Ord f => Model o t f -> Xs o t -> Int -> LbIx -> LogFloatSource

onTransition :: Ord f => Model o t f -> Xs o t -> Int -> LbIx -> LbIx -> LbIx -> LogFloatSource

lbNum :: Xs o t -> Int -> IntSource

lbOn :: Xs o t -> Int -> LbIx -> Maybe tSource

lbIxs :: Xs o t -> Int -> [LbIx]Source