Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
Help us understand the problem. What is going on with this article?

Keras

Keras 基本事項

compile

model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['acc'])

fit

history = model.fit(x, y, validation_split=0.25, epochs=50, batch_size=16, verbose=1)

evaluate

訓練したモデルの評価を行う

predict

訓練したモデルを使って、実際に個別のデータに対して性能を見る。

save

結果を描画する

fitが返すHistoryオブジェクトから損失率、正解率を描画することができる。

plt.plot(history.history['acc'])
plt.plot(history.history['val_acc'])
plt.legend(['Train', 'Test'], loc='upper left')
plt.savefig("acc.png")

また、DataFrameに変換してから描画することもできる。

df_history = pd.DataFrame(history.history)
df_history.plot()
plt.savefig()

RNN LSTMによる文章分類

ksktkd
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away