def test_joint_feature2():
    (g, x, y) = more_complex_graph()
    g.initialize(x, y)
    jf = g.joint_feature(x, y)
    assert_array_equal(jf, jf)
    assert_array_almost_equal(jf, np.array([3.0, 3.0, 3.0, 0.0, 0.0, 0.0, 0.63, 0.66, 0.69, 0.72, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.111, 0.0, 0.0, 0.0, 0.221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.222, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]))
    g = NodeTypeEdgeFeatureGraphCRF(2, [2, 3], [3, 4], np.array([[1, 2], [2, 3]]))
    node_f = [np.array([[1, 1, 1], [2, 2, 2]]), np.array([[0.11, 0.12, 0.13, 0.14], [0.21, 0.22, 0.23, 0.24], [0.31, 0.32, 0.33, 0.34]])]
    edges = [np.array([[0, 1]]), np.array([[0, 2]]), None, None]
    edge_f = [np.array([[0.111]]), np.array([[0.221, 0.222]]), None, None]
    x = (node_f, edges, edge_f)
    y = np.hstack([np.array([0, 1]), (2 + np.array([0, 1, 2]))])
    g.initialize(x, y)
    jf = g.joint_feature(x, y)
    assert_array_equal(jf, jf)
    assert_array_almost_equal(jf, np.array([1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 0.11, 0.12, 0.13, 0.14, 0.21, 0.22, 0.23, 0.24, 0.31, 0.32, 0.33, 0.34, 0.0, 0.111, 0.0, 0.0, 0.0, 0.0, 0.221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.222, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]))
    node_f = [np.array([[2, 2, 2], [1, 1, 1]]), np.array([[0.31, 0.32, 0.33, 0.34], [0.11, 0.12, 0.13, 0.14], [0.21, 0.22, 0.23, 0.24]])]
    edges = [np.array([[1, 0]]), np.array([[1, 0]]), None, None]
    edge_f = [np.array([[0.111]]), np.array([[0.221, 0.222]]), None, None]
    x = (node_f, edges, edge_f)
    y = np.hstack([np.array([1, 0]), (2 + np.array([2, 0, 1]))])
    g.initialize(x, y)
    jf = g.joint_feature(x, y)
    assert_array_equal(jf, jf)
    assert_array_almost_equal(jf, np.array([1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 0.11, 0.12, 0.13, 0.14, 0.21, 0.22, 0.23, 0.24, 0.31, 0.32, 0.33, 0.34, 0.0, 0.111, 0.0, 0.0, 0.0, 0.0, 0.221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.222, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]))
def test_joint_feature2():
    (g, x, y) = more_complex_graph()
    g.initialize(x, y)
    jf = g.joint_feature(x, y)
    assert_array_equal(jf, jf)
    assert_array_almost_equal(jf, np.array([3.0, 3.0, 3.0, 0.0, 0.0, 0.0, 0.63, 0.66, 0.69, 0.72, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.111, 0.0, 0.0, 0.0, 0.221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.222, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]))
    g = NodeTypeEdgeFeatureGraphCRF(2, [2, 3], [3, 4], np.array([[1, 2], [2, 3]]))
    node_f = [np.array([[1, 1, 1], [2, 2, 2]]), np.array([[0.11, 0.12, 0.13, 0.14], [0.21, 0.22, 0.23, 0.24], [0.31, 0.32, 0.33, 0.34]])]
    edges = [np.array([[0, 1]]), np.array([[0, 2]]), None, None]
    edge_f = [np.array([[0.111]]), np.array([[0.221, 0.222]]), None, None]
    x = (node_f, edges, edge_f)
    y = np.hstack([np.array([0, 1]), (2 + np.array([0, 1, 2]))])
    g.initialize(x, y)
    jf = g.joint_feature(x, y)
    assert_array_equal(jf, jf)
    assert_array_almost_equal(jf, np.array([1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 0.11, 0.12, 0.13, 0.14, 0.21, 0.22, 0.23, 0.24, 0.31, 0.32, 0.33, 0.34, 0.0, 0.111, 0.0, 0.0, 0.0, 0.0, 0.221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.222, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]))
    node_f = [np.array([[2, 2, 2], [1, 1, 1]]), np.array([[0.31, 0.32, 0.33, 0.34], [0.11, 0.12, 0.13, 0.14], [0.21, 0.22, 0.23, 0.24]])]
    edges = [np.array([[1, 0]]), np.array([[1, 0]]), None, None]
    edge_f = [np.array([[0.111]]), np.array([[0.221, 0.222]]), None, None]
    x = (node_f, edges, edge_f)
    y = np.hstack([np.array([1, 0]), (2 + np.array([2, 0, 1]))])
    g.initialize(x, y)
    jf = g.joint_feature(x, y)
    assert_array_equal(jf, jf)
    assert_array_almost_equal(jf, np.array([1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 0.11, 0.12, 0.13, 0.14, 0.21, 0.22, 0.23, 0.24, 0.31, 0.32, 0.33, 0.34, 0.0, 0.111, 0.0, 0.0, 0.0, 0.0, 0.221, 0.0, 0.0, 0.0, 0.0, 0.0, 0.222, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]))