"Keras:모델 사용"의 두 판 사이의 차이
둘러보기로 가기
검색하러 가기
(새 문서: == 개요 == 모델을 만들었으면, 어떻게 사용해야 할까?? <syntaxhighlight lang="python"> pred_input = next(test_data) # 인풋 데이터 pred = model.predic...) |
(차이 없음)
|
2021년 12월 24일 (금) 14:23 기준 최신판
개요[편집 | 원본 편집]
모델을 만들었으면, 어떻게 사용해야 할까??
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()