Hello everyone!) Guys, help with advice and example please =))

I understand with neural networks in matlab. "Designing" manually, here's the code:

function net = myNET() INP =[]; %входной вектор OUTP = []; %выходной вектор k=1; for i=-1.5:0.1:1.5 INP(k)= i; OUTP(k)=sin(i); %хочу обучить сеть для вычисления синуса.. просто для понятия того, как это вообще делается =) k=k+1; end net= newff(INP,OUTP,10); net= train(net,INP,OUTP); net.trainParam.epochs = 1200; net.trainParam.show = 25; 

After that in the Command Window I do the following:

  a= myNET 

Here the parameters of the NA were highlighted. Next, I enter:

 >> b= sim(myNET,1) % т.е вычисление значения в точке "1", я правильно понял!?) 

Result:

b = 0.8117

It turns out quite wrong ((

Please tell me where I am wrong and how can I fix it? =) Thank you very much in advance!

ps As an example yuzal: http://freestee.ru/index.php/programming/neuralnetworks/10-matlabgreenwave?format=pdf

    1 answer 1

    I do not remember exactly the matlabovskogo toolbox, correct if you made a mistake - you create a multilayer perceptron with 10 neurons in the hidden layer. Something from the above passage seems to me that you first train the network with default parameters (how many epochs are there, 100, 10?), And then you set them up, you may not have enough training time. In the evening I will see how I did it myself, maybe I'll see something else. Well, just as a piece of advice

     for i=-1.5:0.1:1.5 INP(k)= i; OUTP(k)=sin(i); %хочу обучить сеть для вычисления синуса.. просто для понятия того, как это вообще делается =) k=k+1; end 

    It is better to replace the next one, it is much faster because of the specifics of the trademark.

     INP=-1.5:0.1:1.5; OUTP=sin(INP); 
    • Thank you so much for the advice! In Matlab I am completely new =) Therefore, I am glad to every little criticism =) I would be very grateful to you if you find a moment in the evening to remember how you did it =) - Intelevgen
    • one
      Refreshed memory, you incorrectly call the function of creating a neural network. it is called with input parameters (an array of dimensions in the number of inputs on 2, in the first column the minimum value of the input, in the second maximum) and parameters of the layers (vector line with the number of neurons in the i-th layer, the last layer output, the number of neurons coincides with the output) . There are additional options. How the function behaves when you call and what it creates there, I can not imagine. Thus, you need to change the function creation to net = newff ([- 5 5], [10 1]); Well, do not forget to rearrange the training setup - aknew