Keras:모델 사용
개요편집
모델을 만들었으면, 어떻게 사용해야 할까??
pred_input = next(test_data) # 인풋 데이터
pred = model.predict(pred_input[0]) # 예측 해본다.
real = pred_input[1] # 실제 정답.
pred = pred.reshape(150, 1) # 1차원으로 줄인다.
real = real.reshape(150, 1)
# 시각화 과정.
import matplotlib.pyplot as plt
fig = plt.figure(facecolor='white', figsize=(20, 10))
ax = fig.add_subplot(111)
ax.plot(real, label='True')
ax.plot(pred, label='Prediction')
ax.legend()
plt.show()