How to use the causality.causal_planner function in causality

To help you get started, we’ve selected a few causality examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mjedmonds / OpenLock / state_exploration.py View on Github external
def main():

    env = gym.make('arm_lock-v0')

    # build causal planner and get the known and unknown action sequences
    data_dir = './scenario_outputs/action_reversal/'
    trial_name = 'ex1_extended'
    demonstration_file = data_dir + trial_name + '.csv'
    perceptual_file = data_dir + 'output_node_' + trial_name + '.mat'

    causal_planner = causality.causal_planner.load_trial(demonstration_file, perceptual_file)

    # setup .csv headers
    col_label = []
    col_label.append('frame')
    for col_name in env.world_def.get_internal_state()['OBJ_STATES']:
        col_label.append(col_name)
    col_label.append('agent')
    for col_name in env.action_space:
        col_label.append(col_name)

    index_map = {name : idx for idx, name in enumerate(col_label)}
    results = [col_label]

    i = 0

    # append initial observation