How to train neural network incrementally in Matlab?

。_饼干妹妹 提交于 2019-12-06 04:22:52

问题


Suppose I have very big train set so that Matlab hangs while training or there is insufficient memory to hold train set.

Is it possible to split the training set into parts and train the network by parts?

Is it possible to train the network with one sample at a time (one by one)?


回答1:


You can just manually divide dataset into batches and train them one after one:

for bn = 1:num_batches
    inputs = <get batch bn inputs>;
    targets = <get batch bn targets>;
    net = train(net, inputs, targets);
end

Though batch size should be greater than 1, but anyway that should reduce memory consumtion for training.

In case of trainlm training alogrithm, net.efficiency.memoryReduction optim could help. Also instead of default trainlm algorithm you can try less memory consuming ones like trainrp. For details on training algorithms check matlab documentation page. I assumed above that you are using corresponding matlab toolbox for neural networks.

Regarding training one sample at a time you could try googling for stochastic gradient descent algorithm. But, it looks like it is not in default set of training algorithm in the toolbox.



来源:https://stackoverflow.com/questions/17628280/how-to-train-neural-network-incrementally-in-matlab

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!