How to resolve out of memory error?
2 次查看(过去 30 天)
显示 更早的评论
I've a problem that occurs when I train the neural network using the code
net = train(net,x,t);
I have got the error "Out of memory. Type HELP MEMORY for your options." Do anybody have idea how to solve this kind of problems?
Thanks
2 个评论
采纳的回答
Greg Heath
2013-5-1
Unfortunately, your problem is not well posed.
You have 27 I/O pairs. The 27 inputs define, at most, a 26-dim subspace. However, you have 830 "components". You need to transform to a smaller space with at most 26 dimensions.
The simplest way is to use a principal components transformation. You can do this separately or use the PROCESSPCA input processing option of fitnet (regression) or patternnet (classification).
The number of equations that you have is
Neq = prod(size(t)) = 12*17 = 204
With H hidden nodes, the number of unknowns(weights) to estimate are
Nw = (I+1)*H+(H+1)*O
where { I N ] = size(x) and [O N ] = size(t)
If you reduce I to 26,
Nw = O + (I+O+1)*H = 12+39*H
and if you wish to have more equations than unknowns,
H <= Hub = -1 + ceil( Neq-O)/(I+O+1) ) = 4
In addition, if you replace 26 with 830, you see the problem.
Fortunately, there are ways to obtain stable, accurate solutions using a variety of methods. The NNTBX offers validation stopping and objective function regularization. However, with only 27 cases, I don't think you should use any for validation. Therefore,
1. Reduce your input dimensions below 27
help/doc processpca
2. Use the regularization training function 'trainbr'.
help/doc trainbr
3. Search for the minimum H that gives you satisfactory results. 10 different weight initialization trials for each value of H = 1:10 may be sufficient.
4. Once you have determined Hopt, you can obtained less biased performance estimates on nontraining data by using 10 repetitions of 9-fold cross-validation with 24 training cases and 3 testing cases. Although there are 27*26*25 = 17,550 ways that you can choose the 3-member test set, it is hard to believe that 10 repetitions of 9-fold cross-validation won't be more than sufficient.
Hope this helps.
Thank you for formally accepting my answer
Greg
0 个评论
更多回答(1 个)
Jan
2013-4-25
As you will find as answer for dozens or euiqvalent questions in this forum, when you search for them:
- Install more RAM
- Close other applications
- Install even more RAM
- clear variables, which are not used anymore
- Use a 64 bit version of OS and Matlab, such that it is useful to:
- Install much more RAM
- Increase the virtual memory, when it does not matter if the program need 100 times longer.
2 个评论
Jan
2013-4-29
@Minnu: If I wasn't clear enought already:
Installing more RAM solves the problem, that the installed RAM is exhausted.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!