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
model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['acc'])
history = model.fit(x, y, validation_split=0.25, epochs=50, batch_size=16, verbose=1)
訓練したモデルの評価を行う
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による文章分類
Author And Source
この問題について(Keras), 我々は、より多くの情報をここで見つけました https://qiita.com/ksktkd/items/77346c8f68745616ac2b著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .