Ejemplo n.º 1
0
def compare_dependence_heatmap():
    e1 = Engine.from_pickle('resources/animals/animals.engine')
    e2 = Engine.from_pickle('resources/animals/animals-lovecat.engine')

    D1 = e1.dependence_probability_pairwise()
    D2 = e2.dependence_probability_pairwise()
    C1 = pu.plot_clustermap(D1)

    ordering = C1.dendrogram_row.reordered_ind

    fig, ax = plt.subplots(nrows=1, ncols=2)
    pu.plot_heatmap(D1, xordering=ordering, yordering=ordering, ax=ax[0])
    pu.plot_heatmap(D2, xordering=ordering, yordering=ordering, ax=ax[1])
Ejemplo n.º 2
0
def render_states_to_disk(filepath, prefix):
    engine = Engine.from_pickle(filepath)
    for i in range(engine.num_states()):
        print '\r%d' % (i, )
        savefile = '%s-%d' % (prefix, i)
        state = engine.get_state(i)
        ru.viz_state(state,
                     row_names=animal_names,
                     col_names=animal_features,
                     savefile=savefile)
Ejemplo n.º 3
0
def launch_analysis():
    engine = Engine(animals.values.astype(float),
                    num_states=64,
                    cctypes=['categorical'] * len(animals.values[0]),
                    distargs=[{
                        'k': 2
                    }] * len(animals.values[0]),
                    rng=gu.gen_rng(7))

    engine.transition(N=900)
    with open('resources/animals/animals.engine', 'w') as f:
        engine.to_pickle(f)

    engine = Engine.from_pickle(open('resources/animals/animals.engine', 'r'))
    D = engine.dependence_probability_pairwise()
    pu.plot_clustermap(D)
Ejemplo n.º 4
0
def load_engine(dist, noise, timestamp):
    print 'Loading %s %f' % (dist, noise)
    return Engine.from_pickle(file(filename_engine(dist, noise, timestamp),'r'))