def plot_pred(y_predicted, y, savefig=True):
# y_predicted.reset_index(drop=1, inplace=1)
index = np.argsort(y)
y = y[index]
# y.shape
yhat = y_predicted[index]
yy = pd.DataFrame([y, yhat])
if yy.shape[1] > yy.shape[0]:
yy = yy.T
yy.reset_index(drop=0, inplace=1)
plt.scatter(yy.index, yy[1], s=.4)
plt.plot(yy.index, yy[0], ls='-', color='red', linewidth=.5)
if savefig:
dt_ = datetime.datetime.now().strftime('%d%b%y_%H%M')
plt.savefig("../graphs/" + dt_ + ".png")
plt.show()
# Check the data before regression (no Na, size, etc)
评论列表
文章目录