ModErn Text Analysis
META Enumerates Textual Applications
|
Internal class that holds scoring information for sequences under the current model. More...
#include <scorer.h>
Public Member Functions | |
void | score (const crf &model, const sequence &seq) |
Finds both transition and state scores, in logarithm and exponential domains. More... | |
void | transition_scores (const crf &model) |
Finds only the transition scores. More... | |
void | state_scores (const crf &model, const sequence &seq) |
Finds only the state scores. More... | |
void | forward () |
Computes the forward trellis. | |
void | backward () |
Computes the backward trellis. | |
void | marginals () |
Computes the marginal probabilities of states and transitions by using the forward-backward algorithm results. | |
double | state (uint64_t time, label_id lbl) const |
double | state_exp (uint64_t time, label_id lbl) const |
double | trans (label_id from, label_id to) const |
double | trans_exp (label_id from, label_id to) const |
double | forward (uint64_t time, label_id lbl) const |
double | backward (uint64_t time, label_id lbl) const |
double | state_marginal (uint64_t time, label_id lbl) const |
double | trans_marginal (label_id from, label_id to) const |
double | loss (const sequence &seq) const |
Computes the loss function for a given sequence. More... | |
Private Member Functions | |
void | transition_marginals () |
Computes the transition marginals. | |
void | state_marginals () |
Computes the state marginals. | |
Private Attributes | |
double_matrix | state_ |
Stores the state scores in log-domain. | |
double_matrix | state_exp_ |
Stores the state scores. | |
double_matrix | trans_ |
Stores the transition scores in log-domain. | |
double_matrix | trans_exp_ |
Stores the transition scores. | |
util::optional< forward_trellis > | fwd_ |
Stores the forward trellis, if computed. | |
util::optional< trellis > | bwd_ |
Stores the backward trellis, if computed. | |
util::optional< double_matrix > | state_mrg_ |
Stores the state marginals, if computed. | |
util::optional< double_matrix > | trans_mrg_ |
Stores the transition marginals, if computed. | |
Internal class that holds scoring information for sequences under the current model.
Finds both transition and state scores, in logarithm and exponential domains.
model | The model to score with |
seq | The sequence to score |
void meta::sequence::crf::scorer::transition_scores | ( | const crf & | model | ) |
Finds only the transition scores.
model | The model to score with |
Finds only the state scores.
model | The model to score with |
seq | The sequence to score |
double meta::sequence::crf::scorer::state | ( | uint64_t | time, |
label_id | lbl | ||
) | const |
time | The time step |
lbl | The state |
double meta::sequence::crf::scorer::state_exp | ( | uint64_t | time, |
label_id | lbl | ||
) | const |
time | The time step |
lbl | The state |
double meta::sequence::crf::scorer::trans | ( | label_id | from, |
label_id | to | ||
) | const |
from | The origin state |
to | The destination state |
double meta::sequence::crf::scorer::trans_exp | ( | label_id | from, |
label_id | to | ||
) | const |
from | The origin state |
to | The destination state |
double meta::sequence::crf::scorer::forward | ( | uint64_t | time, |
label_id | lbl | ||
) | const |
time | The time step |
lbl | The state |
double meta::sequence::crf::scorer::backward | ( | uint64_t | time, |
label_id | lbl | ||
) | const |
time | The time step |
lbl | The state |
double meta::sequence::crf::scorer::state_marginal | ( | uint64_t | time, |
label_id | lbl | ||
) | const |
time | The time step |
lbl | The state |
double meta::sequence::crf::scorer::trans_marginal | ( | label_id | from, |
label_id | to | ||
) | const |
from | The origin state |
to | The destination state |
double meta::sequence::crf::scorer::loss | ( | const sequence & | seq | ) | const |
Computes the loss function for a given sequence.
seq | The reference sequence |