33 std::cerr <<
"Can't allocate memory. OUT OF MEMORY\t" << __FUNCTION__ << std::endl;
38 double sum(-INFINITY);
40 for(
size_t position = 0; position <
seq_size-1; position++){
42 for (
size_t previous = 0; previous <
state_size ; previous++){
43 for (
size_t current = 0; current <
state_size; current++){
44 (*dbl_baum_welch_score)[position][previous][current] = (*dbl_forward_score)[position][previous] +
getTransition(
hmm->
getState(previous), current, position) + (*
hmm)[current]->get_emission_prob(*
seqs, position+1) + (*dbl_backward_score)[position+1][current];
48 for (
size_t previous = 0; previous <
state_size ; previous++){
49 for (
size_t current = 0; current <
state_size; current++){
50 (*dbl_baum_welch_score)[position][previous][current] -= sum;
61 std::cout <<
"Transitions to Start:\n";
62 double updated(-INFINITY);
65 std::cout <<
hmm->
getStateName(st) <<
"\t" << exp(updated) << std::endl;
68 float_2D numerator(state_size, std::vector<float>(state_size,-INFINITY));
69 float_2D denominator(state_size, std::vector<float>(state_size,-INFINITY));
71 for (
size_t position = 0; position <
seq_size-1; position++){
83 std::cout << exp((numerator[i][j]-denominator[i][j])) <<
"\t";
85 std::cout << std::endl;