コード例 #1
0
                elif (ts in ts1):
                    test_dict[ts] = intersection
                    print("Yo", test_dict[ts])
                else:
                    print("Not in path %s" % (ts))

count = 0
num_loc = 0
target = "plots/"
ax.legend([path, validation], ["# points: %d" % (num_loc)])

for ts in dict_path2:
    count += 1
    update(validation, [dict_path2[ts][0]], [dict_path2[ts][1]])
    if ts in test_dict:
        num_loc += 1
        update(path, [test_dict[ts][0]], [test_dict[ts][1]])
        ax.legend([path, validation], ["# points: %d\ntime: %s" % (num_loc, ts)])
        # for i in range(6):
        #     update(path, [test_dict[ts][i][0]], [test_dict[ts][i][1]])
        #     ax.legend([path, validation], ["# points: %d\ntime: %s" % (num_loc, ts)])

    # plt.savefig(target + "/%03d.png" % count)
    ax.set_title("%s\nUsing Downhill Simplex Algortihm" % (name))
    plt.pause(0.2)

print(utility.root_mean_square_error(dict_path2, test_dict))
ax.set_title("%s\nUsing Downhill Simplex Algortihm\nRMSQ: %f" % (name, utility.root_mean_square_error(dict_path2, test_dict)))
# plt.savefig(target + "/%03d.png" % count)
plt.show()
コード例 #2
0
                    print("Yo", test_dict[ts])
                else:
                    print("Not in path %s" % (ts))

count = 0
num_loc = 0
target = "plots/test/" + name
ax.legend([path, validation], ["# points: %d" % (num_loc)])

for ts in dict_path2:
    count += 1
    update(validation, [dict_path2[ts][0]], [dict_path2[ts][1]])
    if ts in test_dict:
        num_loc += 1
        update(path, [test_dict[ts][0]], [test_dict[ts][1]])
        ax.legend([path, validation],
                  ["# points: %d\ntime: %s" % (num_loc, ts)])
        # for i in range(6):
        #     update(path, [test_dict[ts][i][0]], [test_dict[ts][i][1]])
        #     ax.legend([path, validation], ["# points: %d\ntime: %s" % (num_loc, ts)])

    # plt.savefig(target + "/%03d.png" % count)
    ax.set_title("%s\nHeurisitic 3" % (name))
    plt.pause(0.2)

print utility.root_mean_square_error(dict_path2, test_dict)
ax.set_title("%s\nHeurisitic 3\nRMSQ: %f" %
             (name, utility.root_mean_square_error(dict_path2, test_dict)))
# plt.savefig(target + "/%03d.png" % (count + 1))
plt.show()
コード例 #3
0
                    print(test_dict1[ts])
                else:
                    print("Not in path %s" % (ts))

count = 0
num_loc = 0
target = "plots/heuristic3/" + name
ax.legend([path, validation], ["# points: %d" % (num_loc)])

for ts in validation_dict1:
    count += 1
    update(validation, [validation_dict1[ts][0]], [validation_dict1[ts][1]])
    if ts in test_dict1:
        num_loc += 1
        update(path, [test_dict1[ts][0]], [test_dict1[ts][1]])
        ax.legend([path, validation],
                  ["# points: %d\ntime: %s" % (num_loc, ts)])

    if not os.path.exists(target):
        os.makedirs(target)

    plt.savefig(target + "/%03d.png" % count)
    ax.set_title("%s\nHeurisitic 3" % (name))
    plt.pause(0.2)

ax.set_title(
    "%s\nHeurisitic 3\nRMSQ: %f" %
    (name, utility.root_mean_square_error(validation_dict1, test_dict1)))
plt.savefig(target + "/%03d.png" % (count + 1))
plt.show()
コード例 #4
0
y_test1 = test_data1[2].tolist()
ts_test1 = test_data1[0].tolist()

test_dict1 = {}
for a, b, c in zip(ts_test1, x_test1, y_test1):
    test_dict1[a] = (b, c)

# plot(ax1, x_test1, y_test1, color='r')

# reading and plotting heuristic1
test_data2 = pd.read_csv("smallest_area/%s.csv" % mac, header=None)
test_data2 = test_data2.loc[test_data2[0].isin(ts1)]
x_test2 = test_data2[1].tolist()
y_test2 = test_data2[2].tolist()
ts_test2 = test_data2[0].tolist()

test_dict2 = {}
for a, b, c in zip(ts_test2, x_test2, y_test2):
    test_dict2[a] = (b, c)

for i in range(len(x_test1)):
    plot(ax1, x_test1[:i + 1], y_test1[:i + 1], "Weighted_mean", color='r')
ax1.legend([mac + "\nRMSQ : " + str(utility.root_mean_square_error(validation_dict1, test_dict1))])

plt.pause(2)

for i in range(len(x_test2)):
    plot(ax2, x_test2[:i + 1], y_test2[:i + 1], "Smallest_area", color='r')
ax2.legend([mac + "\nRMSQ : " + str(utility.root_mean_square_error(validation_dict1, test_dict2))])
plt.show()