

def test_initialize():
    rnd = np.random.RandomState(0)
    feats = rnd.normal(size=(17, 3))
    edges = np.zeros((0, 2), dtype=np.int)
    x = (feats, edges, 4)
    y = rnd.randint(5, size=17)
    crf = LatentNodeCRF(n_labels=5, n_features=3)
    crf.initialize([x], [y])
    assert_equal(crf.n_states, (5 + 2))
    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, x.initialize, X=[x], Y=[y])

dataset/ETHPy150Open pystruct/pystruct/pystruct/tests/test_models/test_latent_node_crf.py test_initialize/VarMisuse@179/219 `crf`->`x`