I am using
tflearn to text classification. I am able to create DNN and fit it and save it and also retrieve it for predictions.
I would like to update trained model with new test data. I checked documentation and also methods but the only way I could figure out is to call
model.fit() which would completely retrain the model and takes a lot of time since it is from scratch.
On other hand
model.save() would just save the loaded model without updating new data.
Is there a function or way to update the trained model with just one data without going through whole retraining process?
Code used to load and save model
model.fit(train_x, train_y, n_epoch=1000, batch_size=8, show_metric=True) model.save('model.tflearn')
Code used to retrieve and load existing model
tf.reset_default_graph() # Build neural network # train_x and train_y had to be regenerated from scratch net = tflearn.input_data(shape=[None, len(train_x)]) net = tflearn.fully_connected(net, 8) net = tflearn.fully_connected(net, 8) net = tflearn.fully_connected(net, len(train_y), activation='softmax') net = tflearn.regression(net) # Define model and setup tensorboard dnn = tflearn.DNN(net, tensorboard_dir='tflearn_logs') dnn.load('./model.tflearn')