本文介绍了验证模型时,Keras 中的verbose 有什么用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是第一次运行 LSTM 模型.这是我的模型:

opt = Adam(0.002)inp = 输入(...)打印(输入)x = 嵌入(....)(inp)x = LSTM(...)(x)x = BatchNormalization()(x)pred = Dense(5,activation='softmax')(x)模型 = 模型(输入,预测)模型.编译(....)idx = np.random.permutation(X_train.shape[0])模型.fit(X_train[idx],y_train[idx],nb_epoch=1,batch_size=128,verbose=1)

在训练模型时verbose有什么用?

解决方案

查看 model.fit 的文档

verbose=2 会像这样提到时代的数量:

I'm running the LSTM model for the first time.Here is my model:

opt = Adam(0.002)
inp = Input(...)
print(inp)
x = Embedding(....)(inp)
x = LSTM(...)(x)
x = BatchNormalization()(x)
pred = Dense(5,activation='softmax')(x)

model = Model(inp,pred)
model.compile(....)

idx = np.random.permutation(X_train.shape[0])
model.fit(X_train[idx], y_train[idx], nb_epoch=1, batch_size=128, verbose=1)

What is the use of verbose while training the model?

解决方案

Check documentation for model.fit here.

By setting verbose 0, 1 or 2 you just say how do you want to 'see' the training progress for each epoch.

verbose=0 will show you nothing (silent)

verbose=1 will show you an animated progress bar like this:

verbose=2 will just mention the number of epoch like this:

这篇关于验证模型时,Keras 中的verbose 有什么用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-25 07:04