Matlab Neural network Mini-batch training

I am now starting to work with neural network toolbox in matlab for big data And I have quite a big dataset of medical image patches.
Currently training is quite slow and I want to use stochastic(feed the net one example at a time)/mini-batch(feed the network few examples at a time) training.
So : Is there a way to use mini-batch learning in matlab?
I found the "adapt" function however in their documentation matlab doesn't recommend using it, The optimal would be some form of training function that would automatically split my data to batches,
I did try several calls to batch on my own with 1 epoch however it didnt get as good results as a normal autoencoder
autotest = configAutoEncoder( 100 , 'epochs' , 1 , 'L2WeightRegularization' , .004 ,'sparsityRegularization' , 4 , 'sparsity' , .15);
autotest.trainParam.showWindow = 0;
epochs = 100;
batchSize = 5000;
batchStart = 1:batchSize:size(xTrain,2)-batchSize+1;
idx = randperm(size(xTrain,2));
idx = 1:size(xTrain,2);
pr = nan(epochs,length(batchStart));
for epoch = 1:epochs
for k = 1:length(batchStart)
bs = batchStart(k);
bidx = idx(bs:bs+batchSize-1);
[ autotest , tr ] = train( autotest , ...
xTrain(:,bidx) , xTrain(:,bidx) ) ;
pr(epoch,k) = tr.perf(end);
end
fprintf( 'epoch:%d , performence : %.2f\n' , epoch , pr(epoch,end) ) ;
end
I am using matlab 2015a Thanks,

2 commentaires

Ekta Prashnani
Ekta Prashnani le 6 Jan 2016
I have the same question. Can minibatch/stochastic training be done using neural network toolbox?
peterukk
peterukk le 27 Sep 2017
I also want to know this! Please help! I have been digging and digging but could not find an answer..there must be some way to apply minibatch training using e.g. the SCG training function (in my case)

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Deep Learning Toolbox dans Centre d'aide et File Exchange

Question posée :

le 14 Nov 2015

Commenté :

le 27 Sep 2017

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by