Ejemplo n.º 1
0
def test_X_Y_indep_Y_causes_MI_X(df_X_Y_indep_Y_causes_MI_X):
    df = df_X_Y_indep_Y_causes_MI_X()

    graph = MVPCStar(data=df).predict()

    assert graph.get_bidirectional_edges() == set({})
    assert graph.get_undirected_edges() == set({})
    assert graph.get_marked_arrows() == set({('y', 'MI_x')})
    assert graph.get_unmarked_arrows() == set({})
    assert graph.get_nodes()
Ejemplo n.º 2
0
def test_Z_causes_X_Y_and_X_Z_causes_MI_Y(df_Z_causes_X_Y_and_X_Z_causes_MI_Y):
    df = df_Z_causes_X_Y_and_X_Z_causes_MI_Y(size=10000)

    graph = MVPCStar(data=df).predict()

    assert graph.get_bidirectional_edges() == set({})
    assert graph.get_undirected_edges() == set(
        {frozenset({'x', 'z'}), frozenset({'z', 'y'})})
    assert graph.get_marked_arrows() == set({('x', 'MI_y'), ('z', 'MI_y')})
    assert graph.get_unmarked_arrows() == set({})
Ejemplo n.º 3
0
def test_long_chains_and_collider_with_MI(df_long_chains_and_collider_with_MI):
    df = df_long_chains_and_collider_with_MI(size=50000)

    graph = MVPCStar(data=df).predict()

    assert graph.get_bidirectional_edges() == set({})
    assert graph.get_undirected_edges() == set(
        {frozenset({'a', 'b'}), frozenset({'e', 'd'})})
    assert graph.get_unmarked_arrows() == set({('b', 'c'), ('d', 'c')})
    assert graph.get_marked_arrows() == set({('c', 'MI_b')})
Ejemplo n.º 4
0
def test_chain_and_collider_without_MI(df_chain_and_collider_without_MI):
    df = df_chain_and_collider_without_MI()

    graph = MVPCStar(data=df).predict()

    assert graph.get_bidirectional_edges() == set({})
    assert graph.get_undirected_edges() == set(
        {frozenset({'a', 'b'}), frozenset({'b', 'c'})})

    assert graph.get_unmarked_arrows() == set({('a', 'd'), ('c', 'd')})
    assert graph.get_marked_arrows() == set({})