Esempio n. 1
0
        # input("after while")


        emo = np.random.random_integers(0,len(emos)-1)
        # print("emo is: "  + str(emos[emo]))
        print("demo_filenames is: " + str(demo_filenames[emo]))
        demos, starts, goals, modes, emos_ignore = rl.process_demos(demo_filenames[emo])
        print("demos is:...")
        vnorm_bins = rl.detect_bins(demos, starts, goals)
        pweights_ = load_weights_numpy(pweight_filenames[emo])
        print("pweights_ is: " + str(pweights_))
        path, err_goal, termination_msg, path_duration = rl.create_path_from_policy(pweights_, start, goal, vnorm_bins, None)
        paths = [path]
        print("path is: "+ str(path))
        path_filename = "exp" + str(subject) + "_"
        rl.save_paths_to_file(paths, start, goal, emos[emo], "subject=" + str(subject), path_filename, i)
        path_filenames.append(path_filename + str(i) + ".csv")
        truth_file.write(str(i) + ":" + str(emos[emo]))
        truth_file.write("\n")
        i+=1

with open ("exp" + str(subject) + "_pathfile_names.txt", "w") as f:
    for path_filename in path_filenames:
        f.write(str(path_filename))
        f.write("\n")
        # input("checking...")
        # print("pweights_ is: " + str(np.shape(pweights_)))
        # print(pweights_)


###################################################################
Esempio n. 2
0
print(pweights_)

# generalized_start = [450,67]
# generalized_goal = [86,396]

# generalized_start = [250,167]
# generalized_goal = [416,196]

# generalized_start = [150,367]
# generalized_goal = [379,112]

generalized_start = [450,467]
generalized_goal = [79,112]

# generalized_start = [250,350]
# generalized_goal = [150,225]



# pweights = rl.SARSA(rweights_, generalized_start, generalized_goal, vnorm_bins, -1)
# path, err_goal, termination_msg, path_duration = rl.create_path_from_policy(pweights, generalized_start, generalized_goal, vnorm_bins, None)

path, err_goal, termination_msg, path_duration = rl.create_path_from_policy(pweights_, generalized_start, generalized_goal, vnorm_bins, None)

paths = [path]
rl.save_paths_to_file(paths, generalized_start, generalized_goal, "test_emo", "test_mode", "aaa", "na")
# path, err_goal, termination_msg, path_duration = rl.create_path_from_policy(pweights_, start, goal, T)