Beispiel #1
0
def load_exp(pipeline, resync='n'):
    exp = Experiment.load(pipeline)
    if resync == 'y':
        exp.wait(retry_interval=5)
        exp.queue.sync(exp.pipeline_path,
                       exp.pipeline_path,
                       sync_to=sge.SyncTo.LOCAL,
                       recursive=True)
    return exp
Beispiel #2
0
def main():
    exp = Experiment.load('color_fix.10')
    plot_with_conf2(exp,
                    'regier_cost',
                    'term_usage',
                    'com_noise',
                    z_label='com $\sigma^2$')
    plot_with_conf2(exp, 'gibson_cost', 'term_usage', 'com_noise')
    plot_with_conf2(exp, 'wellformedness', 'term_usage', 'com_noise')
def main():
    consensus_iters = 10
    e = com_enviroments.make('wcs')

    k = 3

    sims = []

    # human maps
    human_maps = list(e.human_mode_maps.values())

    # robo maps
    exp = Experiment.load('color_fix.1')
    robo_maps = exp.reshape('agent_language_map')

    human_rand = evaluate.mean_rand_index(human_maps)
    exp.log.info('mean rand for all human maps = {:.3f}'.format(human_rand))

    robo_rand = evaluate.mean_rand_index(robo_maps)
    exp.log.info('mean rand for all agent maps = {:.3f}'.format(robo_rand))

    cross_rand = evaluate.mean_rand_index(human_maps, robo_maps)
    exp.log.info(
        'mean rand cross human and robot maps = {:.3f}'.format(cross_rand))

    for k in range(3, 12):
        cielab_map = evaluate.compute_cielab_map(e,
                                                 k,
                                                 iter=consensus_iters,
                                                 bw_boost=1)
        e.plot_with_colors(cielab_map,
                           save_to_path=exp.pipeline_path + 'cielab_map_' +
                           str(k) + '.png')

        human_consensus_map = Correlation_Clustering.compute_consensus_map(
            human_maps, k=k, iter=consensus_iters)
        e.plot_with_colors(human_consensus_map,
                           save_to_path=exp.pipeline_path +
                           'human_consensus_language_map_' + str(k) + '.png')

        robo_consensus_map = Correlation_Clustering.compute_consensus_map(
            robo_maps, k=k, iter=consensus_iters)

        e.plot_with_colors(robo_consensus_map,
                           save_to_path=exp.pipeline_path +
                           'consensus_language_map_' + str(k) + '.png')

        # compare human and robo maps
        rand_i = adjusted_rand_score(human_consensus_map, robo_consensus_map)
        print('rand i between human consensus and agent consensus = {:.3f}'.
              format(rand_i))
        sims += [rand_i]

    sims = np.array(sims)
    print(sims.mean())
def visualize(pipeline_name):
    print('plot results')
    exp = Experiment.load(pipeline_name)

    viz.plot_with_std(exp,
                    'gibson_cost', 'com_noise', 'msg_dim',
                      measure_label='Gibson communication efficiency',
                      x_label='Communication noise',
                      z_label='terms')
    viz.plot_with_std(exp, 'gibson_cost', 'perception_noise', 'msg_dim')
    viz.plot_with_std(exp, 'gibson_cost', 'com_noise', 'perception_noise')

    viz.plot_with_std(exp, 'regier_cost', 'com_noise', 'msg_dim')
    viz.plot_with_std(exp, 'wellformedness', 'com_noise', 'msg_dim')
Beispiel #5
0
def main():
    args = exp_shared.parse_script_arguments()
    # Run experiment
    if args.pipeline == '':
        exp = run(args.host_name)
    else:
        # Load existing experiment
        exp = Experiment.load(args.pipeline)
        if args.resync == 'y':
            exp.wait(retry_interval=5)
            exp.queue.sync(exp.pipeline_path, exp.pipeline_path, sync_to=sge.SyncTo.LOCAL, recursive=True)


    cluster_ensemble = exp.get_flattened_results('agent_language_map')
    consensus = Correlation_Clustering.compute_consensus_map(cluster_ensemble, k=10, iter=100)
    print(consensus.values())

    # Visualize experiment
    visualize(exp)