如何用喀什加里绘制模型历史

2024-10-06 11:41:12 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在使用Kashgari来训练LSTM模型。如何绘制每一步的测试/val精度和损失历史?我知道Kashgari的tensorboard有功能,但我想用matplotlib可视化。对于keras,我使用以下代码来可视化:

def plot_metrics(history): # summarize history for accuracy plt.plot(history.history['acc']) plt.plot(history.history['val_acc']) plt.title('model accuracy') plt.ylabel('acc') plt.xlabel('epoch') plt.legend(['train', 'test'], loc='upper left') plt.show() # summarize history for loss plt.plot(history.history['loss']) plt.plot(history.history['val_loss']) plt.title('model loss') plt.ylabel('loss') plt.xlabel('epoch') plt.legend(['train', 'test'], loc='upper left') plt.show()

有可能用喀什喀里模式来实现这一点吗


Tags: formodelplottitle可视化pltvalhistory