Exemple #1
0
def main():
    config = get_config_from_args()
    visualizer = Visualizer(config)

    if config.dir:
        visualizer.replay_dir()
    else:
        visualizer.replay_file()
Exemple #2
0
import numpy as np
np.random.seed(1)  # NumPy
import random
random.seed(2)  # Python
from tensorflow import set_random_seed
set_random_seed(3)  # Tensorflow

from causality_detection.feed_forward import Evaluation
from visualization.visualizer import Visualizer

if __name__ == '__main__':
    evaluation = Evaluation()
    visualizer = Visualizer()

    experiment_key = 'cnet_wiki_exp_0'

    settings = {
        'dataset_file': 'causal_pairs_dataset_1000.csv',
        'result_file': 'results.json',
        'embedding_model_file': 'files/GoogleNews-vectors-negative300.bin',
        'causal_net_file': 'causal_net_1m.pickle',
        'n_pair': 1000,
        'n_expand': 0,
        'result_key': 'cnet_wiki_exp_0'
    }

    evaluation.run_experiment(settings=settings)

    # settings['threshold'] = 10
    # settings['result_key'] = 'luo_threshold_10'
    # evaluation.run_experiment_on_luos_method(settings)
        robot_parameter=robot_params,
        sim_parameter=sim_params)
    pilcotrac = PILCOTRAC(robot_params,
                          sim_params,
                          robot_state,
                          pathHandler,
                          motion_model,
                          feedforward,
                          SUBS=150)

    # Wait to load visualizer
    print("Example Knicklenkung PILCO")
    print("\trobot_state = ", robot_state)

    # Visualization
    vis = Visualizer(robot_params, pathHandler, robot_state)
    # sleep(3.0)
    SUBS = 400

    T = 30
    T_sim = 2500
    J = 10

    with tf.Session() as sess:
        max_yerror = 0.3

        X1, Y1, k = pilcotrac.rollout(None,
                                      max_yerror,
                                      data_mean=None,
                                      data_std=None,
                                      lookahead=1.22,
Exemple #4
0
from visualization.visualizer import Visualizer

if __name__ == '__main__':
    parser = argparse.ArgumentParser()
    parser.add_argument("-k", "--key", default=None, help="Experiment key")
    parser.add_argument("-v",
                        "--visualize",
                        default='no',
                        help="Generate output charts")

    args = parser.parse_args()
    experiment_key = args.key
    visualize = args.visualize

    evaluation = Evaluation()
    visualizer = Visualizer()

    settings = {
        'dataset_file': 'causal_pairs_dataset_1000.csv',
        'result_file': 'results.json',
        'embedding_model_file': 'files/GoogleNews-vectors-negative300.bin',
        'causal_net_file': 'causal_net_1m.pickle',
        'n_pair': 1000,
        'n_expand': 0,
        'result_key': 'cnet_wiki_exp_0'
    }

    if experiment_key == 'cnet_wiki_exp_0':
        evaluation.run_experiment(settings=settings)

    if experiment_key == 'cnet_wiki_exp_1':
def main():
    if len(sys.argv) < 2:
        raise ValueError('At least one file or folder needs to be provided')
    results = Summary.loads(*sys.argv[1:])
    vis = Visualizer(results)

    f = plt.figure()

    ax = f.add_subplot(231)
    vis.plot_metric(lambda s: s.precision, name='Precision', ax=ax, legend=False, print_params=True)
    ax = f.add_subplot(232)
    vis.plot_metric(lambda s: s.tp + s.fn, name='Sampled Positives', ax=ax, legend=False)

    def _f1(p, r):
        f1 = np.zeros(shape=p.shape)
        pr_sum = p + r
        i = pr_sum > 0
        f1[i] = 2 * p[i] * r[i] / pr_sum[i]

        return f1

    ax = f.add_subplot(233)
    vis.plot_metric(lambda s: _f1(s.precision, s.recall), name='F1 score', ax=ax, legend=False)
    ax = f.add_subplot(234)
    vis.plot_metric(lambda s: s.recall, name='Recall', ax=ax, legend=False)
    ax = f.add_subplot(235)
    vis.plot_metric(lambda s: s.unique, name='Number of unique actions', ax=ax, legend=False)
    ax = f.add_subplot(236)
    vis.plot_metric(lambda s: s.unique_positive, name='Number of unique positive actions', ax=ax, legend=True)

    plt.show()