Example #1
0
def test_two_views_column_partition_normal__ci_(lovecat):
    D = retrieve_normal_dataset()

    engine = Engine(D.T,
                    outputs=[5, 0, 1, 2, 3, 4],
                    cctypes=['normal'] * len(D),
                    rng=gu.gen_rng(12),
                    num_states=64)

    if lovecat:
        engine.transition_lovecat(N=200)
    else:
        engine.transition(N=200)

    P = engine.dependence_probability_pairwise()
    R1 = engine.row_similarity_pairwise(cols=[5, 0, 1])
    R2 = engine.row_similarity_pairwise(cols=[2, 3, 4])

    pu.plot_clustermap(P)
    pu.plot_clustermap(R1)
    pu.plot_clustermap(R2)

    P_THEORY = [
        [1, 1, 1, 0, 0, 0],
        [1, 1, 1, 0, 0, 0],
        [1, 1, 1, 0, 0, 0],
        [0, 0, 0, 1, 1, 1],
        [0, 0, 0, 1, 1, 1],
        [0, 0, 0, 1, 1, 1],
    ]
    return engine
Example #2
0
def test_two_views_row_partition_bernoulli__ci_(lovecat):
    D = retrieve_bernoulli_dataset()

    if lovecat:
        engine = Engine(D.T,
                        cctypes=['categorical'] * len(D),
                        distargs=[{
                            'k': 2
                        }] * len(D),
                        Zv={
                            0: 0,
                            1: 0,
                            2: 1,
                            3: 1
                        },
                        rng=gu.gen_rng(12),
                        num_states=64)
        engine.transition_lovecat(N=100,
                                  kernels=[
                                      'row_partition_assignments',
                                      'row_partition_hyperparameters',
                                      'column_hyperparameters',
                                  ])
    else:
        engine = Engine(D.T,
                        cctypes=['bernoulli'] * len(D),
                        Zv={
                            0: 0,
                            1: 0,
                            2: 1,
                            3: 1
                        },
                        rng=gu.gen_rng(12),
                        num_states=64)
        engine.transition(N=100,
                          kernels=[
                              'view_alphas',
                              'rows',
                              'column_hypers',
                          ])

    R1 = engine.row_similarity_pairwise(cols=[0, 1])
    R2 = engine.row_similarity_pairwise(cols=[2, 3])

    pu.plot_clustermap(R1)
    pu.plot_clustermap(R2)
    return engine
Example #3
0
def test_two_views_row_partition_normal__ci_(lovecat):
    D = retrieve_normal_dataset()

    engine = Engine(D.T,
                    cctypes=['normal'] * len(D),
                    Zv={
                        0: 0,
                        1: 0,
                        2: 0,
                        3: 1,
                        4: 1,
                        5: 1
                    },
                    rng=gu.gen_rng(12),
                    num_states=64)

    if lovecat:
        engine.transition_lovecat(N=100,
                                  kernels=[
                                      'row_partition_assignments',
                                      'row_partition_hyperparameters',
                                      'column_hyperparameters',
                                  ])
    else:
        engine.transition(N=100,
                          kernels=[
                              'view_alphas',
                              'rows',
                              'column_hypers',
                          ])

    R1 = engine.row_similarity_pairwise(cols=[0, 1, 2])
    R2 = engine.row_similarity_pairwise(cols=[3, 4, 5])

    pu.plot_clustermap(R1)
    pu.plot_clustermap(R2)
    return engine
Example #4
0
def test_two_views_column_partition_bernoulli__ci_(lovecat):
    D = retrieve_bernoulli_dataset()

    engine = Engine(D.T,
                    cctypes=['categorical'] * len(D),
                    distargs=[{
                        'k': 2
                    }] * len(D),
                    rng=gu.gen_rng(12),
                    num_states=64)
    if lovecat:
        engine.transition_lovecat(N=200)
    else:
        # engine = Engine(
        #     D.T,
        #     cctypes=['bernoulli']*len(D),
        #     rng=gu.gen_rng(12),
        #     num_states=64)
        engine.transition(N=200)

    P = engine.dependence_probability_pairwise()
    R1 = engine.row_similarity_pairwise(cols=[0, 1])
    R2 = engine.row_similarity_pairwise(cols=[2, 3])

    pu.plot_clustermap(P)
    pu.plot_clustermap(R1)
    pu.plot_clustermap(R2)

    P_THEORY = [
        [1, 1, 1, 0, 0, 0],
        [1, 1, 1, 0, 0, 0],
        [1, 1, 1, 0, 0, 0],
        [0, 0, 0, 1, 1, 1],
        [0, 0, 0, 1, 1, 1],
        [0, 0, 0, 1, 1, 1],
    ]
    return engine