ModErn Text Analysis
META Enumerates Textual Applications
|
Special trellis for the normalized forward algorithm. More...
#include <trellis.h>
Public Member Functions | |
forward_trellis (uint64_t size, uint64_t labels) | |
Constructs a forward_trellis with the given number of time steps and labels. More... | |
double | normalizer (uint64_t idx) const |
void | normalize (uint64_t idx) |
Performs normalization on the given time step and stores the normalizer. More... | |
Public Member Functions inherited from meta::sequence::trellis | |
trellis (uint64_t size, uint64_t labels) | |
Constructs a new trellis with the given number of time steps and labels. More... | |
uint64_t | size () const |
void | probability (uint64_t idx, const label_id &tag, double prob) |
Sets the value in the trellis for the given time step and label. More... | |
double | probability (uint64_t idx, const label_id &tag) const |
Obtains the value in the trellis for the given time step and label. More... | |
Private Attributes | |
std::vector< double > | normalizers_ |
storage for the normalizers for each time step | |
Additional Inherited Members | |
Protected Attributes inherited from meta::sequence::trellis | |
util::dense_matrix< double > | trellis_ |
storage for the scores | |
Special trellis for the normalized forward algorithm.
In addition to storing the scores like a normal trellis, it also stores the normalizers (and can perform normalization on a given time step).
meta::sequence::forward_trellis::forward_trellis | ( | uint64_t | size, |
uint64_t | labels | ||
) |
Constructs a forward_trellis with the given number of time steps and labels.
size | The number of time steps |
labels | The number of labels |
double meta::sequence::forward_trellis::normalizer | ( | uint64_t | idx | ) | const |
idx | The time step |
void meta::sequence::forward_trellis::normalize | ( | uint64_t | idx | ) |
Performs normalization on the given time step and stores the normalizer.
idx | The time step |