我正在浏览 this reinforcement learning tutorial 到目前为止它真的很棒但是有人可以解释一下
newQ = model.predict(new_state.reshape(1,64), batch_size=1)
和
model.fit(X_train, y_train, batch_size=batchSize, nb_epoch=1, verbose=1)
是什么意思?
参数 bach_size
、nb_epoch
和 verbose
有什么作用?
我了解神经网络,所以用它来解释会很有帮助。
您也可以向我发送一个链接,其中可以找到这些函数的文档。
最佳答案
首先令我惊讶的是你找不到 documentation但我猜你只是在搜索时运气不好。
model.fit
的文档说明:
fit(self, x, y, batch_size=32, nb_epoch=10, verbose=1, callbacks=[], validation_split=0.0, validation_data=None, shuffle=True, class_weight=None, sample_weight=None)
batch_size
: integer. Number of samples per gradient update.nb_epoch
: integer, the number of times to iterate over the training data arrays.verbose
: 0, 1, or 2. Verbosity mode. 0 = silent, 1 = verbose, 2 = one log line per epoch.
在 model.predict
的情况下,batch_size
参数只是用于每个预测步骤的样本数。因此调用一次 model.predict
会消耗 batch_size
个数据样本。这有助于快速处理大型矩阵的设备(例如 GPU)。
关于python - model.predict() 和 model.fit() 有什么作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37973005/