def inference_data():
    '\n    Testing with a single type of nodes. Must do as 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)
    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
    edge_weights_horizontal = np.repeat(pw_horz[np.newaxis, :, :], edge_list[0].shape[0], axis=0)
    edge_weights_vertical = np.repeat(pw_vert[np.newaxis, :, :], edge_list[1].shape[0], axis=0)
    edge_weights = np.vstack([edge_weights_horizontal, edge_weights_vertical])
    res = lp_general_graph((- x.reshape((- 1), n_states)), edges, edge_weights)
    edge_features = edge_list_to_features(edge_list)
    x = ([x.reshape((- 1), n_states)], [edges], [edge_features])
    y = y.ravel()
    return (x, y, pw_horz, pw_vert, res, n_states)
Testing with a single type of nodes. Must do as well as EdgeFeatureGraphCRF
def inference_data():
    '\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)
    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
    edge_weights_horizontal = np.repeat(pw_horz[np.newaxis, :, :], edge_list[0].shape[0], axis=0)
    edge_weights_vertical = np.repeat(pw_vert[np.newaxis, :, :], edge_list[1].shape[0], axis=0)
    edge_weights = np.vstack([edge_weights_horizontal, edge_weights_vertical])
    res = lp_general_graph((- x.reshape((- 1), n_states)), edges, edge_weights)
    edge_features = edge_list_to_features(edge_list)
    x = ([x.reshape((- 1), n_states)], [edges], [edge_features])
    y = y.ravel()
    return (x, y, pw_horz, pw_vert, res, n_states)