def test_bw_beta_all_equal(self): # check that all betas are the same # get_beta() function already implemented in hmm.py as part of the # support code beta = get_beta(self.seq, self.model) print "beta: " format_array_print(beta) num_rows = shape(beta)[0] num_cols = shape(beta)[1] for r in range(num_rows): for c in range(num_cols): self.assertAlmostEqual(beta[r, c], 1.0 / 3)
def test_bw_gamma_first_col_equal(self): # check that the first column of gamma are the same # get_gamma(), get_beta(), get_alpha() functions already implemented in # hmm.py as part of the support code alpha, logp = get_alpha(self.seq, self.model) beta = get_beta(self.seq, self.model) gamma = get_gamma(alpha, beta) print "gamma: " format_array_print(gamma) gamma_first_value = gamma[0, 0] num_rows = shape(gamma)[0] for r in range(1, num_rows): self.assertAlmostEqual(gamma_first_value, gamma[r, 0])