Beispiel #1
0
# All predictions together
# plt.plot(y_test, "bo")
# plt.plot(y_pred, "ro")
# plt.fill_between(
#     np.arange(len(upper)), lower, upper, alpha=0.2, color="r",
#     label="Pred. interval")
# # plt.xlabel("Ordered samples.")
# # plt.ylabel("Values and prediction intervals.")
# # plt.xlim([0, 500])
# plt.show()

# 2D scatter plot: true vs. predicted glucose level

plt.figure()
clf_name = clf.__str__().split("(")[0]
plt.scatter(y_test, y_pred, s=2, alpha=0.5)
plt.plot([np.min(y_test), np.max(y_test)],
         [np.min(y_test), np.max(y_test)],
         c='g',
         alpha=0.7)
# plt.axvline(x=70, c='r', alpha=0.5)
# plt.axvline(x=200, c='r', alpha=0.5)
plt.title(clf_name + ": true vs. predicted glucose level")
plt.xlim([0, np.max(y_test)])
plt.xlabel("true glucose levels")
plt.ylim([0, np.max(y_pred)])
plt.ylabel("predicted glucose levels")
plt.savefig(PATH_TO_OUTPUT + clf_name + "(" + str(num_pat) + ").png",
            bbox_inches='tight')
plt.show()