Hello! I'm trying to play with neural networks toolbox. I've tought a network to predict values of
sin(x/1150)+1
function using 10 previous values. I used
x = 1:1:240*60
to generate targets set. Training goes just fine and ntstool asks me whether I want to test my network. I test it using values generated for
x = 1:1:480*60.
It says that MSE is 4e-12. I think it's great. I generate a matrix-only function in order to use this network. Unfortunately, when I try to test it with my own code, results are awful. The net cannot even predict the first 50 values! I think the problem is in my test code, here it is:
x = (240 * 60 - 10):1:(240*60); % keys
func = @(x) sin(x/100) + 1; % predicted function
y = func(x); % expected values
vi = []; % initial values
start = 1;for i = drange(start:start+9) vi = [vi [y(i)]];endx2 = (240 * 60+1):1:(240*60+4000);y2 = func(x2); % we will predict these values
y1 = [];for i = drange(x2) [v, vi2] = myNeuralNetworkFunction(i, vi); % predit a single value
y1 = [y1 [v]]; % save it
vi = vi([ 1+1:end 1:1 ]); % shift left by 1 value
vi(10) = v; % and append predicted value to the list
endplot(x2, y2, '-r');hold onplot(x2, y1, '-g');
Could anyone help me?
Best Answer