def test_pruning(): for h in utils.hypergraphs(): w = numpy.random.random(len(h.edges)) original_path = pydecode.best_path(h, w) marginals = pydecode.marginals(h, w) best = w.T * original_path.v print marginals[1] a = np.array(marginals > 0.99 * best, dtype=np.uint8)
def test_pruning(): for h in utils.hypergraphs(): w = numpy.random.random(len(h.edges)) original_path = pydecode.best_path(h, w) marginals = pydecode.marginals(h, w) best = w.T * original_path.v print marginals[1] a = np.array(marginals > 0.99* best, dtype=np.uint8)
def test_main(): for hypergraph in utils.hypergraphs(): log_pot = numpy.random.random(len(hypergraph.edges)) inside = numpy.random.random(len(hypergraph.edges)) yield check_best_path, hypergraph, log_pot yield check_best_path_matrix, hypergraph yield check_inside, hypergraph, inside yield check_inside, hypergraph, log_pot yield check_outside, hypergraph, log_pot yield check_posteriors, hypergraph, inside yield check_max_marginals, hypergraph, log_pot yield check_semirings, hypergraph
def test_main(): for graph in hypergraphs(): # yield check_all_valid, graph yield check_numbering, graph yield check_hypergraph, graph assert utils.check_fully_connected(graph)