Awesome video! I just have a question, how would you describe what you're seeing in the regression window, I didn't understand that well what was happening in there.
Hi Kody, great video ( Thank you ). I am using MATLAB 2017a, tried to follow your example as I am a beginner on the MATLAB NN toolbox. I get an array index exceeded for the 'for loop' using length(y), so I changed it to length(y_model). Not sure how did your work as the size of 'y_model' is a lot smaller than size of 'y'?
Hi Kody, thanks a lot for the VDO. However, I have been trying to use an existing network which was an optimized one to use in the future but when I run it again they seem not get the same result so I have to do more time to train again and again. It would be appreciated if you could give an advice.
Hi Khamtan, Because the code I showed in the video uses random initial weights, sometimes this does result in bad results and the actual goodness of fit of the model can change since the random weights change when you run it. My advice would be to try a few times and with different numbers of nodes. Double check your model against new data that was not included in the training set and see how well it works. Once you get a good model, save it as a file from there. I don't know the exact code off the top of my head, but you should be able to use your new weights from the good model as a starting point for a new or modified model. I hope this helps.
Hey Mr. Powell, you use for training the Levenberg-Marquardt-Algorithm. It's one of the Algorithm you can choose that are implemented by Matlab. I want to use the stochastic-gradient-descent-Algorithm. Do you have an idea how I can change to this?
Few questions- 1) should we prefer fitnet or feedforwardnet for these type of problems? 2) I guess feedforwardnet uses mapminmax processing function. Is it better to keep the default or to use something like zscore for normalisation???if so how can we do it?? This is because my data has lot of stray points unlike the data in the video.
Thanks. Do you know how to use trained network "net" from workspace in Simulink? For example in User defined block with "[Y,Xf,Af] = sim(net,X,Xi,Ai,T)" function how to bring "net" to the block? Best
thanks for such a detailed video on NN. i have a question , can we define multiple NN at same time with are sub-part of same system and can train them like a MISO system ?
Hi, Thanks for the video. I have a question. In the code, i swapped the positions of x1 and x2 after training the net, i.e. the plot is between values of y and x2. However, now, even though the value of R is .99, there is a huge difference between the actual value and ANN model in the plot. Can you explain why? Thanks
If you train the model with your input variables in a certain order, then be careful to feed the variables into that model in that same order. If this is what you've already done, I'd suggest just trying to re-fit the model or try different numbers of nodes. My code uses random initial weights, so the fitting routine can actually produce different results from one try to the next even if your code doesn't change. That's a downside of this method. There is a lot of trial and error involved. I'd suggest trying different numbers of nodes (and even multiple times for each) until you get a fit you are satisfied with. It's helpful to save your neural net so that you can go back to it and use it again if you get reasonable results.
Please can you create same video with a data from external source but not generated and how to split the data into training, target and test datasets. I am actually lost there. I am just a beginner
Here's the full code: N = 2000; % number of total data points to use in training/testing/validation % Generate random inputs between 0 and 10 x1 = rand(N,1)*10; x2 = rand(N,1)*10; x3 = rand(N,1)*10; x4 = rand(N,1)*10; x5 = rand(N,1)*10; x6 = rand(N,1)*10; y = 10*sin(x1)+sqrt(x2)+5*x3+0.05*x4.^0.6-.003*x5.^3-log(x6) + 2*randn(N,1); %create a complex functional relationship between y and 6 different inputs %this is be the data to which a neural network model will be fit X = [x1 x2 x3 x4 x5 x6]; %arrange all input data into a single matrix and transpose n = 6; net = feedforwardnet(n); %define a neural network (a variable called "net"), which is a 3-layer %perceptron (3LP) with n nodes in the hidden layer [net, TR] = train(net, X', y'); x1 = (0:0.1:10); x2 = 5; x3 = 5; x4 = 5; x5 = 5; x6 = 5; y = 10*sin(x1)+sqrt(x2)+5*x3+0.05*x4.^0.6-.003*x5.^3-log(x6); % create y "data", but with noise removed y_model = zeros(length(x1),1); % initialize y_model vector with zeros for i = 1:length(y) y_model(i) = net([x1(i); x2; x3; x4; x5; x6]); %simulate neural network with varying x1, but all other variables %constant end figure(2) plot(x1, y, '.', x1, y_model) xlabel('x1') ylabel('y') legend('actual', 'ANN model')
Thank you so much for the video. really helps
Thanks a lot sir for this informative video
Awesome video! I just have a question, how would you describe what you're seeing in the regression window, I didn't understand that well what was happening in there.
Hi Kody, great video ( Thank you ). I am using MATLAB 2017a, tried to follow your example as I am a beginner on the MATLAB NN toolbox. I get an array index exceeded for the 'for loop' using length(y), so I changed it to length(y_model). Not sure how did your work as the size of 'y_model' is a lot smaller than size of 'y'?
Hi Kody, thanks a lot for the VDO. However, I have been trying to use an existing network which was an optimized one to use in the future but when I run it again they seem not get the same result so I have to do more time to train again and again. It would be appreciated if you could give an advice.
Hi Khamtan,
Because the code I showed in the video uses random initial weights, sometimes this does result in bad results and the actual goodness of fit of the model can change since the random weights change when you run it. My advice would be to try a few times and with different numbers of nodes. Double check your model against new data that was not included in the training set and see how well it works. Once you get a good model, save it as a file from there. I don't know the exact code off the top of my head, but you should be able to use your new weights from the good model as a starting point for a new or modified model. I hope this helps.
Hey Mr. Powell,
you use for training the Levenberg-Marquardt-Algorithm. It's one of the Algorithm you can choose that are implemented by Matlab. I want to use the stochastic-gradient-descent-Algorithm. Do you have an idea how I can change to this?
Nice work thanks. What about using the neural App on mathwork?
Thanks for the great video demonstration
Few questions-
1) should we prefer fitnet or feedforwardnet for these type of problems?
2) I guess feedforwardnet uses mapminmax processing function. Is it better to keep the default or to use something like zscore for normalisation???if so how can we do it?? This is because my data has lot of stray points unlike the data in the video.
Thanks. Do you know how to use trained network "net" from workspace in Simulink? For example in User defined block with "[Y,Xf,Af] = sim(net,X,Xi,Ai,T)" function how to bring "net" to the block? Best
Fantastic!!!
،I have problem with prediction
Could you help me
This problem
While training, R2=1 turns out. Testing is very low.
How can to prevent that
thanks for such a detailed video on NN. i have a question , can we define multiple NN at same time with are sub-part of same system and can train them like a MISO system ?
did you find a solution i am in the same problelm
Hi, Thanks for the video. I have a question.
In the code, i swapped the positions of x1 and x2 after training the net, i.e. the plot is between values of y and x2. However, now, even though the value of R is .99, there is a huge difference between the actual value and ANN model in the plot. Can you explain why? Thanks
If you train the model with your input variables in a certain order, then be careful to feed the variables into that model in that same order. If this is what you've already done, I'd suggest just trying to re-fit the model or try different numbers of nodes. My code uses random initial weights, so the fitting routine can actually produce different results from one try to the next even if your code doesn't change. That's a downside of this method. There is a lot of trial and error involved. I'd suggest trying different numbers of nodes (and even multiple times for each) until you get a fit you are satisfied with. It's helpful to save your neural net so that you can go back to it and use it again if you get reasonable results.
So how did you get the equation for the function (y)?
Hello
What is the code for that plot that appears every time you run the program?
where to use Back propagation technique
Please can you create same video with a data from external source but not generated and how to split the data into training, target and test datasets. I am actually lost there. I am just a beginner
thank you for much
Thank you so much, can I have a code that you written in the video.
Sir if you have that coding pls send to my mail id
can you show your code below line 43?
Here's the full code:
N = 2000;
% number of total data points to use in training/testing/validation
% Generate random inputs between 0 and 10
x1 = rand(N,1)*10;
x2 = rand(N,1)*10;
x3 = rand(N,1)*10;
x4 = rand(N,1)*10;
x5 = rand(N,1)*10;
x6 = rand(N,1)*10;
y = 10*sin(x1)+sqrt(x2)+5*x3+0.05*x4.^0.6-.003*x5.^3-log(x6) + 2*randn(N,1);
%create a complex functional relationship between y and 6 different inputs
%this is be the data to which a neural network model will be fit
X = [x1 x2 x3 x4 x5 x6];
%arrange all input data into a single matrix and transpose
n = 6;
net = feedforwardnet(n);
%define a neural network (a variable called "net"), which is a 3-layer
%perceptron (3LP) with n nodes in the hidden layer
[net, TR] = train(net, X', y');
x1 = (0:0.1:10);
x2 = 5; x3 = 5; x4 = 5; x5 = 5; x6 = 5;
y = 10*sin(x1)+sqrt(x2)+5*x3+0.05*x4.^0.6-.003*x5.^3-log(x6);
% create y "data", but with noise removed
y_model = zeros(length(x1),1);
% initialize y_model vector with zeros
for i = 1:length(y)
y_model(i) = net([x1(i); x2; x3; x4; x5; x6]);
%simulate neural network with varying x1, but all other variables
%constant
end
figure(2)
plot(x1, y, '.', x1, y_model)
xlabel('x1')
ylabel('y')
legend('actual', 'ANN model')
@@kodymerlin1 sir can you please send the MATLAB coding
very good