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);


Updates:
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

349 comments:

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

    ReplyDelete
    Replies
    1. hi i am trying to perform stegnography using Back Prap. how i can do this

      Delete
  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

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

    ReplyDelete
  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?

    ReplyDelete
    Replies
    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

      Delete
  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,,

    ReplyDelete
  6. Hi Steve

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

    Abhishek

    ReplyDelete
  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.

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

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

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

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

      Delete
  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

    ReplyDelete
  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].

    ReplyDelete
    Replies
    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

      Delete
  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

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

    ReplyDelete
    Replies
    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.

      Delete
  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.

    ReplyDelete
  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.

    ReplyDelete
    Replies
    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.

      Delete
    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.

      Delete
    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 :)

      Delete
    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 :)

      Delete
  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.

    ReplyDelete
  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.

    ReplyDelete
    Replies
    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.

      Delete
    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............

      Delete
  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..

    ReplyDelete
    Replies
    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.

      Delete
    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.

      Thanks in advance

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

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

      Delete
    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

      Delete
  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

    ReplyDelete
    Replies
    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

      Delete
  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???

    ReplyDelete
    Replies
    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)

      Delete
    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,

      Delete
  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.

    ReplyDelete
    Replies
    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.

      Delete
  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

    ReplyDelete
  23. This comment has been removed by the author.

    ReplyDelete
  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...

    ReplyDelete
    Replies
    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

      Delete
  25. Hi,

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

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

      Delete
    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..

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

      Delete
  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???

    ReplyDelete
    Replies
    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
      load net_trained
      and then call directly
      y1=sim(net,[1 1 1]');

      Delete
  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

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

      Delete
  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'.

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

      I have updated the blog with T replaced by O

      Delete
  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

    ReplyDelete
    Replies
    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.

      Delete
  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

    ReplyDelete
    Replies
    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

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

    ReplyDelete
  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....

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

      Delete
  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??

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

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

    Thank you.

    ReplyDelete
  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

    ReplyDelete
  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?

    ReplyDelete
    Replies
    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

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

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

      Delete
  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

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

      Delete
  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?

    ReplyDelete
  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?

    ReplyDelete
  41. 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.

    ReplyDelete
    Replies
    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.

      Delete
  42. 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

    ReplyDelete
    Replies
    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 .

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

    ReplyDelete
  44. 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.

    ReplyDelete
  45. 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 .

    ReplyDelete
  46. 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

    ReplyDelete
  47. 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

    ReplyDelete
  48. 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..

    ReplyDelete
  49. 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

    ReplyDelete
  50. 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.

    ReplyDelete
  51. 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.....?

    ReplyDelete
    Replies
    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

      Delete
    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.

      Delete
  52. 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

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

      Delete
    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....

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

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

      Delete
  54. 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

    ReplyDelete
  55. 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.

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

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

    ReplyDelete
  58. 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.

    ReplyDelete
    Replies
    1. A= xlsread ('C:\Mat_SS.xlsx');
      B= xlsread ('C:\Mat_Distance.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);

      "

      Delete
    2. transpose you data
      A= xlsread ('C:\Mat_SS.xlsx');
      B= xlsread ('C:\Mat_Distance.xlsx');
      I= A(:,1);
      O= B(:,1);

      I=I';
      O=O';

      Delete
  59. 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.

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

      Delete
  60. 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?

    ReplyDelete
  61. 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

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

      Delete
    2. This comment has been removed by the author.

      Delete
    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.

      Delete
  62. This comment has been removed by the author.

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

    ReplyDelete
    Replies
    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

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

      Delete
  64. 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


    ReplyDelete
  65. 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


    Thanks in advance

    ReplyDelete
  66. 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.

    ReplyDelete
  67. 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

    ReplyDelete
  68. 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.

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

    ReplyDelete
  70. 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?
    Thanks in advance
    Orlando
    yaguaso@gmail.com

    ReplyDelete
  71. 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.

    ReplyDelete
  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.

    ReplyDelete
  73. 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.

    ReplyDelete
  74. 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

    ReplyDelete
  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

    ReplyDelete
  76. Best post, thanks for sharing such a wonderful post.
    Visit our website:
    IEC code online
    www.indianwesterlies.blogspot.com

    ReplyDelete
  77. 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.

    ReplyDelete
  78. 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.

    ReplyDelete
  79. 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.

    ReplyDelete
  80. 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 .

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

    ReplyDelete
  82. 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.

    ReplyDelete
  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.

    ReplyDelete
  84. 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.

    ReplyDelete
  85. 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

    ReplyDelete
  86. This comment has been removed by the author.

    ReplyDelete
  87. 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!

    ReplyDelete
  88. 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

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

    ReplyDelete
  90. Nice to read this article..... Thanks for sharing.....
    advanced excel training

    ReplyDelete
  91. This comment has been removed by the author.

    ReplyDelete
  92. This comment has been removed by the author.

    ReplyDelete
  93. This comment has been removed by the author.

    ReplyDelete
  94. 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

    ReplyDelete
  95. 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

    ReplyDelete
  96. 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

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

    ReplyDelete
  98. 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

    ReplyDelete
  99. 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

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

    ReplyDelete
  101. Great thoughts you got there, believe I may possibly try just some of it throughout my daily life.
    angularjs training in chennai
    Click here:
    angularjs2 training in chennai
    Click here:
    angularjs4 Training in Chennai
    Click here:
    angularjs5 Training in Chennai
    Click here:
    angularjs6 Training in Chennai
    Click here:
    Microsoft azure training in chennai

    ReplyDelete
  102. Thanks a lot very much for the high quality and results-oriented help. I won’t think twice to endorse your blog post to anybody who wants and needs support about this area.
    Click here:
    Microsoft azure training in velarchery
    Click here:
    Microsoft azure training in sollinganallur
    Click here:
    Microsoft azure training in btm
    Click here:
    Microsoft azure training in rajajinagar

    ReplyDelete
  103. Thanks for the informative article. This is one of the best resources I have found in quite some time. Nicely written and great info. I really cannot thank you enough for sharing.
    Blueprism training in Chennai

    Blueprism training in Bangalore

    Blueprism training in Pune

    Blueprism online training

    ReplyDelete
  104. Great post! I am actually getting ready to across this information, It’s very helpful for this blog.Also great with all of the valuable information you have Keep up the good work you are doing well.
    Devops Training in Chennai

    Devops Training in Bangalore

    Devops Training in pune

    ReplyDelete
  105. Thanks for one marvelous posting! I enjoyed reading it; you are a great author. I will make sure to bookmark your blog and may come back someday. I want to encourage that you continue your great posts, have a nice weekend!
    nebosh courses in chennai

    ReplyDelete
  106. Wow it is really wonderful and awesome thus it is very much useful for me to understand many concepts and helped me a lot. it is really explainable very well and i got more information from your blog.


    rpa training in electronic-city | rpa training in btm | rpa training in marathahalli | rpa training in pune

    ReplyDelete
  107. Awesome..You have clearly explained …Its very useful for me to know about new things..Keep on blogging..
    Online IT Training Self Placed Videos

    Sales Force Training Self Placed Videos

    ReplyDelete
  108. I really appreciate for your brilliant Efforts on spending time to post this information in a simple and systematic manner, so That visitors and readers can easily Understand the concept.I Efforts must appreciate you posting these on information.
    Oracle BPM Training institute

    Oracle SCM Training institute

    ReplyDelete
  109. You blog post is just completely quality and informative. Many new facts and information which I have not heard about before. Keep sharing more blog posts.
    java training in chennai | java training in bangalore

    java online training | java training in pune

    ReplyDelete
  110. This is such a good post. One of the best posts that I\'ve read in my whole life. I am so happy that you chose this day to give me this. Please, continue to give me such valuable posts. Cheers!

    angularjs Training in chennai
    angularjs Training in chennai

    angularjs-Training in tambaram

    angularjs-Training in sholinganallur

    angularjs-Training in velachery

    ReplyDelete
  111. I just see the post i am so happy the post of information's.So I have really enjoyed and reading your blogs for these posts.Any way I’ll be subscribing to your feed and I hope you post again soon.

    best selenium training institute in hyderabad
    best selenium online training institute in hyderabad
    best institute for selenium training in hyderabad
    best software testing training institute in hyderabad

    ReplyDelete
  112. Thanks for sharing,this blog makes me to learn new thinks.
    interesting to read and understand.keep updating it.

    Education
    Technology

    ReplyDelete

  113. Here is STUCORNER the Best IT training institute in Laxmi Nagar you can visit their site:
    Best Training institute for IT training
    Thanks for sharining your post

    Here is STUCORNER the Best java training institute in Laxmi Nagar you can visit their site:
    Best Java Training institute

    ReplyDelete
  114. Nice Article,Great experience for me by reading this info.
    thanks for sharing the information with us.keep updating your ideas.
    Selenium Training in T nagar
    Selenium Certification Training in T nagar
    Selenium Training in OMR
    Selenium Training in Sholinganallur

    ReplyDelete
  115. I was looking for this certain information for a long time. Thank you and good luck.
    python course in pune
    python course in chennai
    python course in Bangalore

    ReplyDelete
  116. Thank you for allowing me to read it, welcome to the next in a recent article. And thanks for sharing the nice article, keep posting or updating news article.

    Selenium Online training | Selenium Certification Online course-Gangboard

    Selenium interview questions and answers

    Selenium interview questions and answers

    ReplyDelete
  117. Hmm, it seems like your site ate my first comment (it was extremely long) so I guess I’ll just sum it up what I had written and say, I’m thoroughly enjoying your blog. I as well as an aspiring blog writer, but I’m still new to the whole thing. Do you have any recommendations for newbie blog writers? I’d appreciate it.
    Top 250+AWS Interviews Questions and Answers 2018 [updated]
    Learn Amazon Web Services Tutorials 2018 | AWS Tutorial For Beginners
    Best AWS Interview questions and answers 2018 | Top 110+AWS Interview Question and Answers 2018
    AWS Training in Pune | Best Amazon Web Services Training in Pune
    AWS Online Training 2018 | Best Online AWS Certification Course 2018
    Best Amazon Web Services Training in Pune | AWS Training in Pune

    ReplyDelete
  118. Hmm, it seems like your site ate my first comment (it was extremely long) so I guess I’ll just sum it up what I had written and say, I’m thoroughly enjoying your blog. I as well as an aspiring blog writer, but I’m still new to the whole thing. Do you have any recommendations for newbie blog writers? I’d appreciate it.
    Top 250+AWS Interviews Questions and Answers 2018 [updated]
    Learn Amazon Web Services Tutorials 2018 | AWS Tutorial For Beginners
    Best AWS Interview questions and answers 2018 | Top 110+AWS Interview Question and Answers 2018
    AWS Training in Pune | Best Amazon Web Services Training in Pune
    AWS Online Training 2018 | Best Online AWS Certification Course 2018
    Best Amazon Web Services Training in Pune | AWS Training in Pune

    ReplyDelete
  119. It seems you are so busy in last month. The detail you shared about your work and it is really impressive that's why i am waiting for your post because i get the new ideas over here and you really write so well.
    Java training in Bangalore | Java training in Marathahalli

    Java training in Bangalore | Java training in Btm layout

    Java training in Bangalore |Java training in Rajaji nagar

    ReplyDelete
  120. I want to know how to write program in MATLAB to calculate the correlation coefficient (r), mean relative error (MRE), root mean square error (RMSE) and absolute fraction of variance (R2) with RBF neural networks.

    ReplyDelete
  121. I want to know how to write program in MATLAB to calculate the correlation coefficient (r), mean relative error (MRE), root mean square error (RMSE) and absolute fraction of variance (R2) with RBF neural networks.

    ReplyDelete
  122. You are doing a great job, this blog post is awesome.

    I want to inform you all that our institute offers various IT courses like:

    Web Designing Course in Jaipur

    Web Development Training Institute in Jaipur

    Graphic Designing Course in Jaipur

    We also provide Training and Internship Course in Jaipur.

    For more info, you can also visit our PTI Academy.

    ReplyDelete
  123. This is really impressive post, I am inspired with your post, do post more blogs like this, I am waiting for your blogs.

    Blockchain course in Chennai

    ReplyDelete
  124. You’ve written a really great article here. Your writing style makes this material easy to understand.. I agree with some of the many points you have made. Thank you for this is real thought-provoking content

    angularjs online training

    apache spark online training

    informatica mdm online training

    devops online training

    aws online training

    ReplyDelete