2 years ago

#76106

test-img

Jonas Van den Borre

Evaluating prediction of model without having to train the model again

So i've searched on the internet and in the documentation to find out i needed to save my model and reload it in another seperate file. Which i did. However, when i run my file to reload the model and predict a different input, the training start al over again. Is there any way to prevent this? Thanks!

First file:

model = Sequential()

model.add(LSTM(units=50, return_sequences=True, input_shape=(x_train.shape[1], 1)))
model.add(Dropout(0.2))
model.add(LSTM(units=50, return_sequences=True))
model.add(Dropout(0.2))
model.add(LSTM(units=50))
model.add(Dropout(0.2))
model.add(Dense(units=1))

model.compile(optimizer='adam', loss='mean_squared_error')
model.fit(x_train, y_train, epochs=25, batch_size=32)

model.save('BTC_model')

Second file:

from tensorflow import keras

model = keras.models.load_model('BTC_model')

python

tensorflow

training-data

0 Answers

Your Answer

Accepted video resources