FreeLing
4.0
|
The class vis_viterbi implements the viterbi algorithm given the weights of different labels, without hidden information. More...
#include <viterbi.h>
Public Member Functions | |
vis_viterbi (const std::wstring &) | |
Constructor: Create dynammic storage for the best path, loading file with model probabilities. | |
std::vector< int > | find_best_path (std::vector< double * > &) const |
find_best_path: perform viterbi algorithm given the weights matrix | |
Private Member Functions | |
void | softmax (double *p) const |
convert weights to probabilities | |
Private Attributes | |
int | N |
N: number of classes. | |
std::vector< double > | p_ini |
p_ini: vector with initial probabilities for each class | |
std::vector< std::vector < double > > | p_trans |
p_trans: matrix with the probability transitions from one class to another e.g. | |
bool | use_softmax |
whether to use softmax to convert given weights to probabilities | |
double | ZERO_logprob |
logprob for probability zero |
The class vis_viterbi implements the viterbi algorithm given the weights of different labels, without hidden information.
freeling::vis_viterbi::vis_viterbi | ( | const std::wstring & | ) |
Constructor: Create dynammic storage for the best path, loading file with model probabilities.
std::vector<int> freeling::vis_viterbi::find_best_path | ( | std::vector< double * > & | ) | const |
find_best_path: perform viterbi algorithm given the weights matrix
Referenced by freeling::bioner::analyze().
void freeling::vis_viterbi::softmax | ( | double * | p | ) | const [private] |
convert weights to probabilities
int freeling::vis_viterbi::N [private] |
N: number of classes.
std::vector<double> freeling::vis_viterbi::p_ini [private] |
p_ini: vector with initial probabilities for each class
std::vector<std::vector<double> > freeling::vis_viterbi::p_trans [private] |
p_trans: matrix with the probability transitions from one class to another e.g.
P(B,B), P(O,B), etc
bool freeling::vis_viterbi::use_softmax [private] |
whether to use softmax to convert given weights to probabilities
double freeling::vis_viterbi::ZERO_logprob [private] |
logprob for probability zero