How can I solve the problem for this code related to retraining a neural network?
Show older comments
Hello I have a question regarding "Neural Network Toolbox User's Guide R2013b". In this document, there are some suggested algorithms to improve generalization in which the first one is retraining neural network. In this document on page 8-36 the program is as follows: [x,t] = house_dataset; Q = size(x,2); Q1 = floor(Q*0.90); Q2 = Q-Q1; ind = randperm(Q); ind1 = ind(1:Q1); ind2 = ind(Q1+(1:Q2)); x1 = x(:,ind1); t1 = t(:,ind1); x2 = x(:,ind2); t2 = t(:,ind2); net = feedforwardnet(10); numNN = 10; NN = cell(1,numNN); perfs = zeros(1,numNN); for i=1:numNN disp(['Training ' num2str(i) '/' num2str(numNN)]) NN{i} = train(net,x1,t1); y2 = NN{i}(x2); perfs(i) = mse(net,t2,y2); end
I have problem with this part of program y2 = NN{i}(x2);. When I run this part of the program Matlab shows this error: ??? Error using ==> network.subsref at 83 Subscript indices must either be real positive integers or logical
It seems as if we want to use cell array indexing, if so, we must use indices in parenthesis instead of x2 which is 10% part of house_dataset. Am I correct in this field? if not, how can I obviate this problem to correct this code? 2. Why do not we use matlab simulation after training the network on the first part of the data set? for instance : y=sim(net,x2,t2) and then calling the performance function. 3. When we use feedforwardnet the data set are automatically divided into three parts. Should we disable this with net. divideFcn="" before running this code? Your kind help is greatly appreciated.
1 Comment
Greg Heath
on 24 Oct 2013
Edited: Greg Heath
on 24 Oct 2013
Please repost using the {} (see the {} icons above the response boxes) to format your code
Accepted Answer
More Answers (1)
Greg Heath
on 24 Oct 2013
You may be interested in my approach. I have several hundred examples in the NEWSREADER and ANSWERS.
Just use the search word
Ntrials
I use fitnet for regression and patternet for classification
Ntrials fitnet
I don't think I posted any using the house_dataset.
2 Comments
Greg Heath
on 25 Oct 2013
Two corrections:
NMSE = mean(variance(error',1)/ mean(variance(target',1))
Rsquared = 1 - NMSE.
Mohamad
on 2 Nov 2013
Categories
Find more on Deep Learning Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!