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

I have the same question. Can minibatch/stochastic training be done using neural network toolbox?
peterukk
peterukk 2017년 9월 27일
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)

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기

질문:

2015년 11월 14일

댓글:

2017년 9월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by