'The relation between Model.fit(batch_size)and Model.predict(batch_size) in keras
I am a novice, and I have encountered the following problems when using Keras to build the model. Model.fit returns history and Model.predict returns the predicted result. I only specified batch_size and epochs in Model.fit, but when I modified batch_size and epochs, the predicted result changed, why? I want to know how model predictions work. This is my code.
e_epoch = 500
e_batch_size = 40
model = Sequential()
model.add(LSTM(16, input_shape=X_train.shape[1:], activation='relu', return_sequences=True))
model.add(LSTM(16, activation='relu'))
model.add(Dense(1))
optimizer = tf.keras.optimizers.Adam(learning_rate=e_LR, decay=e_decay)
model.compile(optimizer=optimizer,loss='MeanAbsoluteError')
history = model.fit(X_train, y_train, epochs=e_epoch, batch_size=e_batch_size, verbose=0, validation_data=(X_valid, y_valid), shuffle=True)
Test = model.predict(X_test)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
