## Wednesday, 23 March 2011

### Starting with neural network in matlab

The neural networks is a way to model any input to output relations based on some input output data when nothing is known about the model. This example shows you a very simple example and its modelling through neural network using MATLAB.

Actual Model
Let us take that our model has three inputs a,b and c and generates an output y. For data generation purposes, let us take this model as
y=5a+bc+7c;

we are taking this model for data generation. In actual cases, you dont have the mathematical model and you generate the data by running the real system.

Let us first write a small script to generate the data
a= rand(1,1000);
b=rand(1,1000);
c=rand(1,1000);
n=rand(1,1000)*0.05;

y=a*5+b.*c+7*c+n;
n is the noise, we added deliberately to make it more like a real data. The magnitude of the noise is 0.1 and is uniform noise.

So our input is set of a,b and c and output is y.
I=[a; b; c];
O=y;
Understanding Neural Networks
Neural network is like brain full of nerons and made of different layers.
The first layer which takes input and put into internal layers or hidden layers are known as input layer.
The outer layer which takes the output from inner layers and gives it to outer world is known as output layer.

The internal layers can be any number of layers.

Each layer is a basically a function which takes some variables (in the form of vector u) and transforms it to another variable(another vector v) by multiplying it with coefficients and adding some biases b. These coefficient is known as weight matrix w. Size of the v vector is known as v-size of the layer.
v=sum(w.*u)+b

So we will make a very simple neural network for our case- 1 input and 1 output layer. We will take the input layer v-size as 5. Since we have three input , our input layer will take u with three values and transform it to a vector of size 5. and our output layer now take this 5 element vector as input and transforms it to a vector of size 1 because we have only on output.

Creating a simple Neural FF Network
We will use matlab inbuilt function newff for generation of model.
First we will make a matrix R which is of 3 *2 size. First column will show the minimum of all three inputs and second will show the maximum of three inputs. In our case all three inputs are from 0 to 1 range, So
R=[0 1; 0 1 ; 0 1];
Now We make a Size matrix which has the v-size of all the layers.
S=[5 1];
Now call the newff function as following
net = newff([0 1;0 1 ;0 1],S,{'tansig','purelin'});
net is the neural model. {'tansig','purelin'} shows the mapping function of the two layers. Let us not waste time on this.

Now as each brain need training, this neural network too need it. We will train this neural network with the data we generated earlier.
net=train(net,I,O);
Now net is trained. You can see the performance curve, as it gets trained.

So now simulate our neural network again on the same data and compare the out.puts.
O1=sim(net,I);
plot(1:1000,O,1:1000,O1);

You can observe how closely the the two data green and blue follow each other.
Let us try scatter plot between simulated output and actual target output.
scatter(O,O1);

Let us observe the weight matrix of the trained model.

net.IW{1}
-0.3684    0.0308   -0.5402
0.4640    0.2340    0.5875
1.9569   -1.6887    1.5403
1.1138    1.0841    0.2439
net.LW{2,1}
-11.1990    9.4589   -1.0006   -0.9138
Now test it again on some other data. What about a=1,b=1 and c=1;

So input matrix will be [1 1 1]';
y1=sim(net,[1 1 1]');
you will see 13.0279. which is close to 13 the actual output (5*1+1*1+12*1);

1. O and T are same variable. define O=T or just replace T everywhere with O
2. S=[5 1], so while defining newff you should pass S or [5 1]. [4 1] is incorrect

1. fuzzy example in matlab http://technical-leader.blogspot.com/2011/09/fuzzy-logic-examples-using-matlabfuzzy.html

1. the url not open....

2. hi i am trying to perform stegnography using Back Prap. how i can do this

2. Time should be still wasted, since on new version newff has new argument list and therefore it does not work.
Hopefully i'll try to comeback when i have studied how to use it :)
My Matlab (R2008a) and FL toolbox v 2.2.7

3. please if you can help me to using ant colony optimization to training neural network in matlab invernoiment?

4. Overall this seems like a great little tutorial, but I'm confused by one thing. It says "we will train this neural network with the data we generated earlier," and then provides the command "net = train (net, I, O)" and continues to reference O as a variable for the rest of the explanation. O, however, was never defined. Did the author, perhaps, intend to use T as the output target data?

1. Hi Steve

Yes , you are right. O and T are same. I forgot to define that. thanks for pointing it out :)
Corrected the mistake
Abhishek

5. @ahmed
training can be seen as fitting the model such that output should match target.. this fitting is an optimization problem over neural netwrk's biases and weights. just try to fit optimize weights and biases such that sum(O1-O)^2 is minimized using any optimization nmethod,,

6. Hi Steve

Yes , you are right. O and T are same. I forgot to define that. thanks for pointing it out :)

Abhishek

7. Neural Network Toolbox provides functions and apps for modeling complex nonlinear systems that are not easily modeled with a closed-form equation. Neural Network Toolbox supports supervised learning with feed forward, radial basis, and dynamic networks. It also supports unsupervised learning with self-organizing maps and competitive layers. With the toolbox you can design, train, visualize, and simulate neural networks. You can use Neural Network Toolbox for applications such as data fitting, pattern recognition, clustering, time-series prediction, and dynamic system modeling and control.

8. @sumit Kumar
thanks for the information, yes you are right, it is very useful and can be used in variety of things

9. thank you very much Gupta and Abhishek...

1. Gupta and Abhishek are the same person here . thanks :)

2. How to create Nural network using input values of large size such as 500X1 etc

10. I have 15inputs and want to come up with two outputs which i will scale down to bits for contol of electric motor speed through variable speed drives.how can i do this using Neural networks considering the inputs are input barley specifications,from two batchs of malt.Ultimately i will be using the two inputs for blending purposes

11. Thank you for this small tutorial.
But I have a confusion,
A. in the first line you defined a,b,c as random no. between 1,1000
and later in matrix as 0,1 max and min values of input. That I didn't get.
B.can a matrix be given as single input or there's a different way to deal with matrices[two dimension].

1. when you say a=random(1,1000) it doesnot mean the a is between 1 and 1000. it means that a is matrix containing 1000 datapoints. all points will be between 0 and 1. that is why the max and min limit is 1 and 0
each input is a single dimension matrix. it should be a column vector. then you should combine all the vectors to a big2D matrix I.

-Abhishek

12. when you say a=random(1,1000) it doesnot mean the a is between 1 and 1000. it means that a is matrix containing 1000 datapoints. all points will be between 0 and 1. that is why the max and min limit is 1 and 0
each input is a single dimension matrix. it should be a column vector. then you should combine all the vectors to a big2D matrix I.

-Abhishek

13. i need help how to train an face image using backpropogation neural network so that output is recognized?

1. You need to extract some features from face. read about feature extraction. then these feature coefficients will work as input. face's name(persons) you can save as numbers and these will be the target of the model. now run a backpropagation model using matlab.

14. You need to extract some features from face. read about feature extraction. then these feature coefficients will work as input. face's name(persons) you can save as numbers and these will be the target of the model. now run a backpropagation model using matlab.

15. I think that you forgot to take into account the noise n in your last test. The mean value of the noise is 0.025, so the estimate 13.0279 is even closer to the model which in average returns 13.025.

1. @jiri Falta, You are right in saying that we should expect the answer to be 13.025 and we get 13.0275 which is pretty close.

But our original model does not have noise. We generated this data ourselves so we knew the noise. But in general, when we work on experimental data, we don't know the noise. So in that case, we expect the correct answer because we have no knowledge about noise. That is why i expect 13 should be the answer.

2. But in that case the program did not have any chance to estimate your original model correctly even if given great amount of data. Any other statistical method would also return something close to y*=5a+bc+7c+mean(n).
However thanks for the tutorial.

3. genrally noise is zero mean, so you don't face this problem. otherwise if this is not zero mean and i know the exact mean, i can incorporate this information to get few more bounds. thanks for the comments :)

4. Yes, generally, but not in your example. That's why I think that the final comparison is not fair to the computer. You might have mocked him for inaccuracy if you had chosen higher amplitude of noise :)

16. @jiri Falta, You are right in saying that we should expect the answer to be 13.025 and we get 13.0275 which is pretty close.

But our original model does not have noise. We generated this data ourselves so we knew the noise. But in general, when we work on experimental data, we don't know the noise. So in that case, we expect the correct answer because we have no knowledge about noise. That is why i expect 13 should be the answer.

17. Sir, i am working on offline signature verification using Neural Network.I have done feature extraction but how to work on neural network .I have to take 100 signatures .Please help.

1. Once you know the features, form the input and target matrix and just use training of it and you are done, you may need to play with some different values of hidden layers and neurons.

2. sir
i have a one proble when i train neural network in second step(using toolbox) selection of input&target values the target values are not shown in browse option sir please help............

18. can u tell me., we should compute square of some five numbers then using these input and output, i should compute output next input numbers..

1. @keeti Hallur
You can try the same approach. read the above blog. Just form your input and target matrix as some numbers and their square and train your network.

then test it using the new values. should work fine.

2. Dear Sir,
Could you kindly explain how to do system identification for a system that has 5 inputs and 2 outputs, using Neural Networks.

3. Do you have pre information about the system? or is it totally unknown?

4. Thanks a lot for your reply, I do have all the information and data about the system if you could help.

5. I'm trying to make the identification of a MISO system by the time I'm using the tool NNSYSID but I could not move and I do not know what steps to take after training the network, I can collaborate with another alternative for the identification of the system. thanks

19. i have image and i want to segmented it into 4 cluster by using competitive learning alogrithm not som .it cpnsist from 2 layer but i dont know i the pixel of image represent the input i mean if image have sise of 200*300 so i have 50000 input ? or what a lot of quetion i have no one answer

1. The whole image is never an input because then you will have lots of value. You first extract feature. feature is something which can give you most of the information. Like orienctation histogram if you are studying the guesture recognition. relative positions of face points if you are doing face recognition.

you need to first decide some feature which define you clustering

20. in the last line u have written "Now test it again on some other data. What about a=1,b=1 and c=1;".r u want to say that in the example u have chosen random no. but now u r insisting with [1,1,1].matrix. One more question....how to adjust the weight???

1. Yes , The data was generated randomly here. but in true sense, it is not generated. I tried to mimic the actaully experiement, So think in this way that data has been given to you by an real experiment done.

Now I want to just test if my system is trained or not. So i just give one more random data. a=1,b-1 c=1 is just some random data. you could have given [a=2 b=3 c=5] and expected an different answer. This step cannot be done when you are in real world. because you didnt know what output to expect as you dont know that y=5a+bc+7c; (because this is unknown)

2. Hi.. I want to know how to write program in MATLAB for RBF neural netwroks. Especially for modeling. Please do help me. reply to satheeshnurgemar@gmail.com,

21. i m doing a project on career counselling using neural network. Can u suggest me how to map the data( means input, which is in string like introvert, extrovert) into matlab dataset.

1. for a computer program, being an introvert or extovert does nt have any meaning.
So you can just assign one of them as 1 and other as 0.
if you have more than 2 options (eg lower class, middle class, upper class), you can use 0, 0. 1 0.2 like this.

22. Sir, i m working on a project that needs the use of ann toolbox in matlab, for that i want complete knowledge of neural network toolbox of matlab. bt as i m a student of mechanical branch i dont know anything about neural networks, so can u please provide me the simple guidelines for the same.
the problem is to provide 3 inputs which will give one output (which shd be optimum)and drawing graphs for the same, nd plz sir reply as soon as possible

23. This comment has been removed by the author.

24. I m designing an ANN for fault detection in transmission line. I have to identify 6 different types of faults, for this i m using 12x51 order matrix as input and have 7x51 order matrix as target/output. I m using 6 different sets of input-target combination to train the n/w. I m not able to train the n/w.

Can anyone just help me to train the n/w and let me the best suitable training function for my application?

PLZ HELP...

1. Read the example, your question is no different
as far as training is considered, there is no rule as of my knowledge
try different functions and see what works best for you

25. Hi,

How can I convert the neural network to state space model?
Thank you..

1. interesting . there are no dynamics in neural netwrk so why statespace?

2. I need a state space identified model in order to use it in MPC controller. But, never mind I have found a method on how to construct neural state space by using a customize neural network..Thank you for your reply..

3. Mamat, how did u do that, can u share?

26. Hi;
in case i've trained my neural network and i've got results close to the target ,how can i fixe weights to get the the model i want,i mean weights are changing every time i train the model , is there any code to get that???

1. you can save the model in a file after you trained.
So first time you run it, after that type
save net_trained net

then next time instead of running the script
just type
and then call directly
y1=sim(net,[1 1 1]');

27. Probably a stupid question, since I'm new to both Matlab & NN.

net = newff([0 1;0 1 ;0 1],[4 1],{'tansig','purelin'});

Wat's the meaning of the [4,1]? Shouldn't it be the S matrix [5,1] ?

Grtz

1. yes theirry
thanks for pointing out the mistake
Corrected it, see the updates

28. I also get two errors, and I don't know how to fix them :)

>>
net = newff([0 1;0 1 ;0 1],[4 1],{'tansig','purelin'});
Warning: NEWFF used in an obsolete way.
> In obs_use at 18
In newff>create_network at 127
In newff at 102
See help for NEWFF to update calls to the new argument list.

>>
net=train(net,I,O);
Undefined function or variable 'O'.

1. Updated the error
T is same as O
so define O=T

I have updated the blog with T replaced by O

29. Hi! Can any one tell me, how do i sure that the performance goal has been reached. Is there a relation between MSE and performance goal......What is the meaning of the following code..............net.trainParam.goal=1e-3

1. It depends on your system's requirement. generally you want to see that network is well trained but not over trained. generally low enough MSE is desired.

30. I am asking a foolish question....but plz help me.
I am creating a neural net whose input set is a matrix (15 x 100) i.e. P. How can i initialize it when declaring newff.Should i take individual row? or is there any mechanism for matrix

1. It depends on how you define your data
generally 15 rows and 100 columns mean 15 inputs and 100 data samples
See the example above, rest is same

31. I want to fit the curve with noisy data of range 0.5 using rbf network,may you help for this?

32. can anybody help on this topic? Its urgent for me...Please help....I want to reconstruct curve from the noisy data using rbf neural network or any other feedforward network....

1. http://www.anc.ed.ac.uk/rbf/rbf.html
may be this help . try using this toolbox

33. can anybody help me with the following problem: I want to train a neural network taking input and output from an external text file ....there are 5 inputs and a single output..how do i get the desired trained network??

1. Read the data first and form I, O matrix and proceed as the examples says

34. Hi there, anyone knows another type of suprovised neural network similar to net = newff?

Thank you.

35. I'm trying to make the identification of a MISO system by the time I'm using the tool NNSYSID but I could not move and I do not know what steps to take after training the network, I can collaborate with another alternative for the identification of the system. thanks

36. I have the 100 samples data. Each sample contains 3 inputs and relevant 12 outputs. The programme needs to train by these data and able to predict suitable outputs for new 3 inputs after that. Do I need to write the programme to read 3 inputs and train the network with all samples or have to consider all 15 data as inputs?

1. you can use all 3 input, just where i had 3 rows in I matrix and one in T, you wuld have 3 rows in I but the output T (O) wuld have 12 rows

-Abhishek

37. i have same output for different inputs... how can i overcome this issue

1. dont worry about that, just code s you would do in any other case.
-
abhishek

38. hi
my name is sina.im studing financial math.i wrote a programme in MATLAB.now I want to use formulas of this programme in neural network.how can I?let I have a (f(x)=x) now I want use tise function at a neural network,how can I? pleas help me.this is my address :
www.sinababaie@yahoo.com

1. describe more about your code. where do you want to use you function.
--
abhishek

39. i am a beginner in neural network in matlab. I want to detect the faulty condition of a single phase induction motor using ann. Can you tell me the procedure to perform the work, please?

40. Hi, I am working on a trivial experiment in which there are 4 categories of images of flowers say rose, tulip, daisy and sunflowers. i intend to train a simple ANN with about 25 images of each and then test the network. The underlying logic i intend to use is a) First, convert the images into simple binary b) then, based on the binaries of the training set and the desired target outputs, carry out the weight adjustments.c) thereafter, the weight can be directly applied to the test cases.
My doubt is can in such trivial cases, this simple kind of a logic work? anything you would want to suggest in this context that would help in more accuracy?

41. they are all black and white images!

42. Hi, Iam Sharath Kumar. My project is image retreival system for which i had extracted the features of an image. Now i want to design retrieval system using neural network can any one help me. pleas help me.this is my email id: saikumar1310@gmail.com.

1. after extracting the features from an image the output is as follows below a 1x4 matrix
1.0e+011 * 1.0448 1.1249 0.0020 1.1254
pls kindly guide me in assigning target and p value.

43. Dear sir,
i have 4 inputs from the radar .like RCS,Velocity of object,Position and Acceleration.and 4 outputs like Pedestrian,bike,car and truck.using the given inputs i want to classify the output objects.its a online process where i just have one value of from the inputs at a time.and using these input i have to decide the output. i have already observed the inputs for each output.and i know that how RCS curves for each output look like.but there are lot of overlaping between car and truck RCS .mean is that i cant classify the track in linear way.can i used neural network in this case to classify the output objects.if yes how can specify the inputs and outputs for neural network.?
thankyou

1. Yes you can, the trick is to categorize output as number 1 2 3 4 and for each data, set ur output as [1 0 0 0] if its car, [0 1 0 0] if the output is bike and so on. input will beusual values .

44. hi im working on emotion recognition using neural network can anyone help me? thanks much

45. Hi this is nik smith:Summer Internship Program & summer training program in Noida, Delhi, NCR. Click to know more or Call us at 0120-3939220.

46. pls can anyone help me? I need a neural network solution for software reliability prediction. I have a failure history as input(30 elements, that is time that failure occurs) and predicted future failures as output(30 elements, that is corresponding number of failures(cumulative) for that time). i need a neural network structure,training and performance evaluation .

47. Thanks for your interesting little tutorial.. i need an example matlab code by cascade correlation neural network.. can u help me? it is so urgent and i need help for implementation..
Thanks

48. Hi all

I need Introduction to neural networks using MATLAB 6.0 by S N DEEPA, if any one has this book or has a direct link to get it please help me. and if also any one has an cascade correlation neural network matlab code example it will be so helpful.. thank u.

Yours

49. Hi all,
my project is load forecasting using neural networks..but I don't know anything about it.so,pls suggest me where to start..

50. hi all
i work in project about speaker verfication by mlp but i donot know how design mlp and how many input and output please help me

51. Hi all,I am working on project STOCK PRICE PREDICTION USING ANN, using RBF and MLP. Please help me in how to start with coding and design in MATLAB. I am ready to pay if anyone individually write code and build&train model for me. Email-id- mayank.patel34@yahoo.co.in
Mail me with ur contact number if interested.

52. hello, i am working on project ANALYSING MACULAR EDEMA IN DIABETIC PATIENTS,using matlab. so can anyone tell about how the nueral networks works on matlab.....?

1. Hi all,I am working on project STOCK PRICE PREDICTION USING ANN using matlab so can anyone tell about how the nueral networks works on matlab.....? for more click here

2. Hi Chaitra and Nik, this example tells you a standard implementation of neural networl. Let me know if you any particular doubts about any step.

53. Hi,
i need to design, train and simulate a radial basis function network without using neural network toolbox. Can anybody help me, Plz.. kkamaljeet47@gmail.com

1. Learn the algorithm and implement it. Do you have doubt ina ny particular steps?

2. I cannot use NEWRB, TRAIN,SIM toolboxes.i need to design, train and simulate a radial basis function network without using neural network toolbox. so that the the resulatant network can estimate the output accurately n with less time.The no. of inputs are 3 and the output is 1. Can anybody help me, Plz.. kkamaljeet47@gmail.comCan you plz provide some initial help , plz....

3. i m ready 2 pay..

54. CAN YOU ENTER THE MATLAB GENERATION OF SINE WAVE GUSING NEURAL NETWORK

1. Hi Megha, I didn't get you question. Can you clarify further?

55. hey, can you give an example for cascade feedforward neural network? when we train the net, are the target must have a same size with the input? thank you

56. Hello, nice article. Can you tell me a NN-method to correlate two images? I have the morphological results to be compared and correlate.

Thank you.

57. How to train a Nural network using input values of large size such as 500X1 for pattern recognition

58. what is the standard syntax or the format of the input data to the Nural Network tool in Matlab

59. I have signal strength in one column and their corresponding distances in 2nd coloumn... Could you please help me to write a code such that when I give signal strength it should be able to predict the distance as accurate as possible.
You can reply to rajtharun.domala@ttu.edu

Thanks.

1. A= xlsread ('C:\Mat_SS.xlsx');
I= A(:,1);
O= B(:,1);

R=[-100 0];

S=[5 1];
net = newff([-100 0],S,{'tansig','purelin'});
net= train(net,I,O); %14th Line
O1=sim(net,I);
plot(A,B,A,O1,'o');

PS:Mat_SS and Mat_Distance are 2 excel sheets having one column with 53 rown in it.

And it shows Error as:

"
??? Error using ==> trainlm at 109
Input data size does not match net.inputs{1}.size.

Error in ==> network.train at 107
[net,tr] = feval(net.trainFcn,net,X,T,Xi,Ai,EW,net.trainParam);

Error in ==> SVM_Try at 14
net= train(net,I,O);

"

2. transpose you data
I= A(:,1);
O= B(:,1);

I=I';
O=O';

60. Hi. Generally, It is stated that more number of input neurons (input data) with respective target value is required for developing accurate neural network architecture. In my study, I have only 15 sets of input data(i.e. 15 experiments for three input variables with their respective output variable). Is it sufficient enough to create an accurate network architecture. kindly answer my question.

1. Its not sufficient in general. but it depends on complexity of data too. for a linear data, 15 may be sufficient.

61. Hello . Thank you for these informations.
Please , can you help me in developing a program that use genetic algorithm and tabu search to optimize the structure and the parameters of the NN?

62. Dear Gupta, et al, This website is very informative. I am a beginner in Matlab and am wondering if you are able to assist in this question.

Say for example, I have 3 to 5 independent variables (let's call them Age, Gender, Language). And on the dependent variables (could be 1 to 6 or more and say two of them is "I use the book to help me study my exam" and "I use the book to learn the theory"), I want to predict say for example, if a person is male, how can I predict that he will use the book to learn the theory or how can I predict that he will use the book to study the exam??? Or if a person is male and he is 25 years old, how can I predict he will use the book to help him study his exam, etc.

I am looking at deriving formulae to solve for this and then use Matlab to code them. The equation I have come across so far is y=a+b_1 x_1+b_2 x_2+...+b_n x_n where b_i are the regression coefficients (multipliers) and x_n are the predictor variables. But now y has multiple possibilities, so y should be equal to a_1+c_1 y_1+c_2 y_2+....

My personal email is kris2099@hotmail.com if anyone can help.

Many thanks.

Kind regards,
Kris

1. Yes you are right.
what is your question actually?

2. This comment has been removed by the author.

3. Hi Gupta.

I am looking at deriving formulae to solve for the following situation and then use Matlab to code them.

I have 3 to 5 independent variables (let's call them Age, Gender, Language, Full or part time, distance or non distance). And the dependent variables could be between 1 to 6 of them (for example, 2 of them could be "I use the book to help me study my exam" and "I use the book to learn the theory"), I want to predict say for example, if a person is male (Gender - from independent variable), how can I predict that he will use the book to learn the theory or how can I predict that he will use the book to study the exam??? Or if a person is female (Gender) and she is 25 years old (Age), how can I predict she will use the book to help him study his exam, etc.

63. This comment has been removed by the author.

64. Hi Gupta. Is there no solution to the above problem? I know it has to do with AI neural network/genetic algorithms.

1. COnstruct the I and O matrices by replacing each qualitative value by a quanititative value. For example if there are seven langauge possibles, assign a number to each language and construct the input data with those indexes. Similarly assign 1 to I use the book to help me study my exam and 2 to I use the book to learn the theory.
for example the following table
studetn1 25 english fulltime i will use book to learn theory
studetn2 23 french fulltime i will use book to learn theory
studetn3 27 english fulltime i will use book to make boats
studetn4 24 gernan parttime i will use book to help in exam

will be transfomred to

25 1 1 1
23 2 1 1
27 1 1 3
24 3 2 2
with three columns as I and last column as O

2. I want to Do feature selection using neural network..how can I do it please tell me??

65. Dear all

I am so interested in ANN and I have a simple data
I have 2 variable inputs data and the output only one
e.g

1st input (time series in second unit) are 14 second 25 second 80 second
2nd input (penicilin in grams) are 0.5 gram 2 gram 0.3 gram
output (amount of amoeba) are 1200unit 80 unit 400unit
so in the matrix form :
input = [14 25 80;0.5 2 0.3]
output = [1200 80 400]

How can I predict for the next second or the previous for the amount of amoeba ?
I mean if I want to know how many amoebas on the 10th second and 30th second

Does it start from train and maybe after that like below :
y1=sim(net,[10 30]);

or any idea...I am sorry maybe this is a stupid question

66. Dear Gupta

I am new to this subject and not much knowledge about the field. Actually i have to make a training system with the help of self organizing maps (SOM) algorithm because i have no categorical information about the data i.e. unsupervised learning.

For Training
I have to use two xlsx sheets to train the model via SOM
first xlsx sheet contains 40 columns and 20 rows (no. row of rows can be increased later on to 1000)
second xlsx sheet contains 24 columns and 25 rows (no. row of rows can be increased later on to 1000)
these two sheets are the input for training model.
Give me an idea to do this in MATLAB on in SCI lab

67. Hi guys I'm new in using that matlab som_toolbox, I performed clustering of iris.data using SOM Toolbox in Matlab. After clustering, I have an input vector and I want to see which cluster this input belongs to? Any tips please on how to map an input pattern into a trained SOM map.

68. Suppose that I performed clustering of iris.data using SOM Toolbox in Matlab. After clustering, I have an input vector and I want to see which cluster this input belongs to? Any tips please on how to map an input pattern into a trained SOM map. I NEED HELP

69. Dear Gupta,
First thing, I really appreciate your kindness on helping others and sharing your knowledge.
Here I go. I try to build convolutional Neural Network(CNN) for certain Biomedical Images. When I came across several sites, they used CNN for Handwritten recognition and achieved around 99.2% Classification accuracy without much preprocessing steps involved. So, I would like to use this idea and try to deploy in my project as achieving classification accuracy close to the reference. I try to implement my idea using theao library. The place I get stucked is
* Creating a dataset for my own biomedical images
For Feeding CNN I must need 28x28 pixels dataset but I have 25 images each hold 940x960 pixels. I don't know how to create my own dataset with. the list of 25 biomedical images.
if you have an idea, please share me. Ur pointer is more appreciable.

70. can i get a complete matlab code to train ANN??

71. Dear Gupta,
I already tried a Fitting problem with inputs of 87x4 matrix, representing a static data of 87 samples of 4 elements and a target 87x22 matrix, representing a static data of 87 samples of 22 elements. The network performed well.
To evaluate the network I tried to perform additional test with an inputs of 1x4, representing a static data o matrix row of 1 sample of 4 elements, but the button of Test network don´t let me to perform the test.
How can I get a desire output of 1x22 matrix? It is necessary any command to perform that requirement?
Orlando
yaguaso@gmail.com

72. Croma Campus are also known as the reputed Android Training Institute in Noida Delhi & NCR. It is widely known that Android Training is a most demanding and user friendly operating system for smart phones and tablets.

73. Croma Campus are also known as the reputed Android Training Institute in Noida Delhi & NCR. It is widely known that Android Training is a most demanding and user friendly operating system for smart phones and tablets.

74. Blessed with more than 15 years of rich experience in providing technical training and courses, we, Croma Campus are effectively providing Robotics Training in Noida We have professional trainers that are wisely recruited considering their experience and qualification.

75. Croma Campus is a best institute for PLC-SCADA Training in Noida we provide training as per latest industry standards that makes our students capable to get placements in their dream jobs at MNCs. At present, At our institute, training is conducted by subject specialist corporate professionals with vast years of experience in managing real-time PLC SCADA projects

76. Croma Campus is a best institute for PLC-SCADA Training in Noida we provide training as per latest industry standards that makes our students capable to get placements in their dream jobs at MNCs. At present, At our institute, training is conducted by subject specialist corporate professionals with vast years of experience in managing real-time PLC SCADA projects

77. Best post, thanks for sharing such a wonderful post.
IEC code online
www.indianwesterlies.blogspot.com

78. Croma campus provides a standout amongst the most enticing and fascinating divisions of Electronics is Robotics training in noida This particular area is included in engineered component to do shifting errands naturally which is executed according to the arranging of the software engineer.

79. Croma campus noida deal in providing Solutions for Education, Labs & Production in the field of Robotics & Embedded systems training institute in noida Croma campus is the best training institute to learn advanced embedded systems course in noida.

80. Croma campus noida best java training institute in noida witch also provide real time working profession trainer with job placement support. And best class room provide lab facilities and more service provide joining croma campus training institute.

81. how to get coomand on matlab coding. My research area is fuzzy neural network for classification.

from where I can get the example and codes .

82. Nice blog, good to see that people are engaging in it. Apply IEC Code Online

83. Hi I have obtained the weights and biases from an already avvailable network but the equation given as HiddenVariableMatrix = tansig( InputWeightMatrix*InputVariableMatrix + Biasvector1);
OutputVariableMatrix = Biasvector2 + LayerWeightMatrix*HiddenVariableMatrix; is not giving me the expected answer. I tried normalisation, but I am not sure about its use. How do I do it is my main doubt.

84. Hi I have obtained the weights and biases from an already avvailable network but the equation given as HiddenVariableMatrix = tansig( InputWeightMatrix*InputVariableMatrix + Biasvector1);
OutputVariableMatrix = Biasvector2 + LayerWeightMatrix*HiddenVariableMatrix; is not giving me the expected answer. I tried normalisation, but I am not sure about its use. How do I do it is my main doubt.

85. solutio plz:
Implementation of Prediction Algorithm using Neural Network
Learning Material: Representing Knowledge using Neural Networks
Language: Java or C# or Matlab
Problem description: we have some data (sample is shown in Table 1) as attached in excel document “DataSet.xlsx”.
Table 1: Sample Data Set
Temperature Humidity Energy Consumed
30 17 57.9
17 12 36.2
91 10 138.4
96 15 148.9
3 13 17.3
65 18 107.6
… … …

We want to have an intelligent algorithm using Neural network that can predict output (consumed energy) based on given input (temperature and humidity values) i.e. you need to consider Temperature and Humidity as input parameter and Energy consumed as output parameter.
You shall implement Neural Network Algorithm to predict consumed energy for given input parameters. We have 100 records in the sample data set. You shall use initial 70 records for training of your neural network and remain 30 records for testing. Report accuracy of your results for training phase and testing phase in terms of mean square error.

86. Contact #DIAC- 931 0096 831 and Get registered for the Summer Training starting from June 1st Week 2017 on Various Technologies like PLC & SCADA, Instrumentation, Embedded Systems, Robotics, AUTOCAD, EPLAN etc. 100% Job Oriented Training.

87. Finding the time and actual effort to create a superb article like this is great thing. I’ll learn many new stuff right here! Good luck for the next post buddy..
Matlab training in chennai

88. This comment has been removed by the author.

89. Dear gupta:nice fundamental demos on ann; pl write how to make, train & utilize a network for solving system of linear&nonlinear equations & differential equations :: citing a few small examples!

90. The blog is absolutely fantastic. Lots of great information and inspiration, both of which we all need. Thanks for such a continuous great postings. IEC Code in India

91. It is amazing and wonderful to visit your site.Thanks for sharing this information,this is useful to me...
Android Training in Chennai
Ios Training in Chennai

92. Online mba in India
DEIEDU is the best online Institute in the world with high class course outline and up to date learning materials. DEIEDU is providing the online mba in india, online mba in india, Distance learning mba courses in india, Correspondence mba in India Mba from distance in India, Online Executive Mba in India, distance Mba from India, Online distance mba in India. Distance learning mba degree in India.
401, fourth floor sg alpha tower
Vashundhra (up)
Phone: 9811210788
Email: info@deiedu.in
Website: http://www.deiedu.in/
online mba in india

93. can you explain more about finding weights after trainig
like what why did we include {1} or {2,1}

95. This comment has been removed by the author.

96. This comment has been removed by the author.

97. This comment has been removed by the author.

98. When I run the program bellow
X=rand (0,100);
Y=x+1;
I=x;
O=y;
R=[0 100];
S=[5 1];

Starting with neural network in matlab

The neural networks is a way to model any input to output relations based on some input output data when nothing is known about the model. This example shows you a very simple example and its modelling through neural network using MATLAB.

Actual Model

Let us take that our model has three inputs a,b and c and generates an output y. For data generation purposes, let us take this model as

y=5a+bc+7c;

we are taking this model for data generation. In actual cases, you dont have the mathematical model and you generate the data by running the real system.

Let us first write a small script to generate the data

a= rand(1,1000);

b=rand(1,1000);

c=rand(1,1000);

n=rand(1,1000)*0.05;

y=a*5+b.*c+7*c+n;

n is the noise, we added deliberately to make it more like a real data. The magnitude of the noise is 0.1 and is uniform noise.

So our input is set of a,b and c and output is y.

I=[a; b; c];

O=y;

Understanding Neural Networks

Neural network is like brain full of nerons and made of different layers.

The first layer which takes input and put into internal layers or hidden layers are known as input layer.

The outer layer which takes the output from inner layers and gives it to outer world is known as output layer.

The internal layers can be any number of layers.

Each layer is a basically a function which takes some variables (in the form of vector u) and transforms it to another variable(another vectorv) by multiplying it with coefficients and adding some biases b. These coefficient is known as weight matrix w. -size of the layer.

v=sum(w.*u)+b

So we will make a very simple neural network for our case- 1 input and 1 output layer. We will take the input layer v-size as 5. Since we have three input , our input layer will take u with three values and transform it to a vector v  of size 5. and our output layer now take this 5 element vector as input u  and transforms it to a vector of size 1 because we have only on output.

Creating a simple Neural FF Network

We will use matlab inbuilt function newff for generation of model.

First we will make a matrix R which is of 3 *2 size. First column will show the minimum of all three inputs and second will show the maximum of three inputs. In our case all three inputs are from 0 to 1 range, So

R=[0 1; 0 1 ; 0 1];

Now We make a Size matrix which has the v-size of all the layers.

S=[5 1];
net = newff([0 100],S,{'tansig','purelin'});
Net=train (net,I,O);
It give me the error (input data size doesn't match net inputs (1).size.
Please can help me

99. When I run the program bellow
X=rand (0,100);
Y=x+1;
I=x;
O=y;
R=[0 100];
S=[5 1];
net = newff([0 100],S,{'tansig','purelin'});
Net=train (net,I,O);
It give me the error (input data size doesn't match net inputs (1).size.
Please can help me

100. When I run the program bellow
X=rand (0,100);
Y=x+1;
I=x;
O=y;
R=[0 100];

S=[5 1];
net = newff([0 100],S,{'tansig','purelin'});
Net=train (net,I,O);
It give me the error (input data size doesn't match net inputs (1).size.
Please can help me

101. Matlab is the best technology at Learning New things. Appreciable blog on Matlab Course

102. Usually I never comment on blogs but your article is so convincing that I never stop myself to say something about it. You’re doing a great job Man,Keep it up.
Matlab Training in Noida

103. Really very informative and creative contents. This concept is a good way to enhance the knowledge.thanks for sharing. please keep it up.
MATLAB training in gurgaon

104. Thanks for such awesome blog. Well explained .Keep sharing
MATLAB Training in Delhi

105. Attractive Blog ..Thank you for sharing .
Best MATLAB Training Institute in Jaipur