예제 #1
0
파일: example.cpp 프로젝트: Haify/ziphmm
int main(int argc, char **args) {
  Forwarder f;
  size_t alphabet_size = 3;
  f.read_seq_directory("sequences", alphabet_size);
  f.write_to_directory("example_out");

  Matrix pi, A, B;
  read_HMM(pi, A, B, "example.hmm");

  std::cout << "log-likelihood: " << f.forward(pi, A, B) << std::endl;
  // std::cout << "log-likelihood: " << f.pthread_forward(pi, A, B)  << std::endl; // parallelized on the lengths of the sequences
  // std::cout << "log-likelihood: " << f.mr_pthread_forward(pi, A, B)  << std::endl; // parallelized version on the number of sequences
  return 0;
}
예제 #2
0
void test_forwarder_multiple_seqs() {
    Forwarder forwarder;
    Matrix pi, A, B;
    size_t no_states, alphabet_size;

    std::cout << "Testing forwarder with multiple sequences: ";
    std::cout.flush();

    read_HMM(pi, A, B, "../test_data/multiple_seqs.hmm");
    no_states = pi.get_height();
    alphabet_size = B.get_width();

    forwarder.read_seq_directory("../test_data/seqs_directory", alphabet_size, no_states, 50);

    assertClose(forwarder.forward(pi, A, B), -52287.6, "Forwarder: Difference in loglikelihood:", 0.0001);
    assertClose(forwarder.pthread_forward(pi, A, B), -52287.6, "pthread_forward: Difference in loglikelihood:", 0.0001);
    assertClose(forwarder.mr_pthread_forward(pi, A, B), -52287.6, "mr_pthread_forward: Difference in loglikelihood:", 0.0001);

    std::cout << "ok." << std::endl;
}