def test_calc_matrix_MAP(): """Tests the Trainer.calc_matrix_MAP function.""" print("\tTesting Trainer.calc_matrix_MAP()...") t = Trainer() MLE_vec = t.calc_vector_MLE() #required because it sets labeldict. MAP_matrix = t.calc_matrix_MAP() fname = DEFAULT_TEST_PATH + "test_calc_matrix_MAP.txt" test_f = open(fname, "w") print(MAP_matrix, file=test_f) print("shape:{}".format(MAP_matrix.shape), file=test_f) print("type:{}".format(MAP_matrix.dtype), file=test_f) print("min:{}".format(MAP_matrix.min()), file=test_f) print("max:{}".format(MAP_matrix.max()), file=test_f) test_f.close()
def test_word_ranking(): t = Trainer() MLE_vec = t.calc_vector_MLE() MAP_matrix = t.calc_matrix_MAP() t.get_word_ranking(MAP_matrix, MLE_vec)