I am training an Elman network and for that reason my datasets (input/target) need to be cell arrays (so that the examples are considered as a sequence by the train function).
But, I don't manage to trigger the use of a validation and test set by the train function.
Here is an example, where I want a validation and test set to be used but the train function is not using any. It seems the "divideind" property and indexes are ignored.
%%Set the parameters of the run
n_neurons = 50; % Number of neurons
n = 1000; % Total number of samples
ne = 500; % Number of epochs
%%Create the samples
% Allocate memory
u = zeros(1, n);x = zeros(1, n);y = zeros(1, n);% Initialize u, x and y
u(1)=randn; x(1)=rand+sin(u(1));y(1)=x(1);% Calculate the samples
for i=2:n u(i)=randn; x(i)=.8*x(i-1)+sin(u(i)); y(i)=x(i);end%%Create the datasets
X=num2cell(u); T=num2cell(y);%%Train and simulate the network
% Create the net and apply the selected parameters
net = newelm(X,T,n_neurons); % Create network
net.trainParam.epochs = ne; % Number of epochsnet.divideFcn = 'divideind';net.divideParam.trainInd = 1:800;net.divideParam.valInd = 801:900;net.divideParam.testInd = 901:1000;[net,tr]= train(net,X,T);
Best Answer