def test_joint_feature_continuous():
    '\n    Testing with a single type of nodes. Must de aw well as EdgeFeatureGraphCRF\n    '
    (X, Y) = generate_blocks_multinomial(noise=2, n_samples=1, seed=1)
    (x, y) = (X[0], Y[0])
    n_states = x.shape[(- 1)]
    edge_list = make_grid_edges(x, 4, return_lists=True)
    edges = np.vstack(edge_list)
    edge_features = edge_list_to_features(edge_list)
    x = ([x.reshape((- 1), 3)], [edges], [edge_features])
    y = y.ravel()
    pw_horz = ((- 1) * np.eye(n_states))
    (xx, yy) = np.indices(pw_horz.shape)
    pw_horz[(xx > yy)] = 1
    pw_vert = ((- 1) * np.eye(n_states))
    pw_vert[(xx != yy)] = 1
    pw_vert *= 10
    if True:
        crf = NodeTypeEdgeFeatureGraphCRF(1, [3], [3], [[2]])
        w = np.hstack([np.eye(3).ravel(), (- pw_horz.ravel()), (- pw_vert.ravel())])
        crf.initialize(x, y)
        y_pred = crf.inference(x, w, relaxed=True)
        joint_feature_y = crf.joint_feature(x, y_pred)
        assert_equal(joint_feature_y.shape, (crf.size_joint_feature,))
Testing with a single type of nodes. Must de aw well as EdgeFeatureGraphCRF
def test_joint_feature_continuous():
    '\n    \n    '
    (X, Y) = generate_blocks_multinomial(noise=2, n_samples=1, seed=1)
    (x, y) = (X[0], Y[0])
    n_states = x.shape[(- 1)]
    edge_list = make_grid_edges(x, 4, return_lists=True)
    edges = np.vstack(edge_list)
    edge_features = edge_list_to_features(edge_list)
    x = ([x.reshape((- 1), 3)], [edges], [edge_features])
    y = y.ravel()
    pw_horz = ((- 1) * np.eye(n_states))
    (xx, yy) = np.indices(pw_horz.shape)
    pw_horz[(xx > yy)] = 1
    pw_vert = ((- 1) * np.eye(n_states))
    pw_vert[(xx != yy)] = 1
    pw_vert *= 10
    if True:
        crf = NodeTypeEdgeFeatureGraphCRF(1, [3], [3], [[2]])
        w = np.hstack([np.eye(3).ravel(), (- pw_horz.ravel()), (- pw_vert.ravel())])
        crf.initialize(x, y)
        y_pred = crf.inference(x, w, relaxed=True)
        joint_feature_y = crf.joint_feature(x, y_pred)
        assert_equal(joint_feature_y.shape, (crf.size_joint_feature,))