LoginSignup
0
0

More than 3 years have passed since last update.

Keras

Posted at

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による文章分類

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0