def test_initialize():
    # 17 nodes, three features, 5 visible states, 2 hidden states
    rnd = np.random.RandomState(0)
    feats = rnd.normal(size=(17, 3))
    edges = np.zeros((0, 2), dtype=np.int)  # no edges
    x = (feats, edges, 4)   # 4 latent variables
    y = rnd.randint(5, size=17)
    crf = LatentNodeCRF(n_labels=5, n_features=3)
    # no-op
    crf.initialize([x], [y])
    assert_equal(crf.n_states, 5 + 2)

    #test initialization works
    crf = LatentNodeCRF()
    crf.initialize([x], [y])
    assert_equal(crf.n_labels, 5)
    assert_equal(crf.n_states, 5 + 2)
    assert_equal(crf.n_features, 3)

    crf = LatentNodeCRF(n_labels=3)
    assert_raises(ValueError, crf.initialize, X=[x], Y=[y])
dataset/ETHPy150Open pystruct/pystruct/pystruct/tests/test_models/test_latent_node_crf.py/test_initialize/original