Prediction does not change after fit
I try to load a checkpoint and continue tuning it, yet I encounter a strange situation that the model.arg_params changed. However, the predictions are exactly the same before and after model.fit.
Following are the codes:
net, arg_params, arg_auxs = mx.model.load_checkpoint('PReluDrop500X100', 0)
model = mx.model.FeedForward(
ctx = mx.gpu(0), num_epoch = m + 10, begin_epoch=m,
symbol = net,
learning_rate = args.lr,
wd = 0.0001,
optimizer = 'adam',
arg_params = arg_params,
)
print model.arg_params['fc1_weight'].asnumpy()
print model.predict(np_to_mxIter(val, 1000)).flatten()[:10]
model.fit(X=trainIter,eval_metric=metricMSE,epoch_end_callback = do_checkpoint('PReluDrop500X100'))
print model.arg_params['fc1_weight'].asnumpy()
print model.predict(np_to_mxIter(val, 1000)).flatten()[:10]
Any ideas of this issue? Thanks.
It seems is about your network and optimization problem. Try normalization of input, different optimizer, and different learning rate
Close for now. Please feel free to reopen it if needed
I have actually encountered the same problem. If I fit the model first, use predict to see the outcomes, continue to fit the model for additional rounds, I can clearly see that the arguments of the model change, nevertheless predictions stay the same.
Adding an epoch end callback function to model.fit works for me. I guess the issue is due to asynchronous data in either MXNet engine or the Python interface. The callback function forces system to synchronize all the parameters.