MATLAB: single layer neural network?

Eventhough this type of question is not encouraged (plz solve my homework! ), I decided to go along and post a solution to your problem.

Eventhough this type of question is not encouraged (plz solve my homework! ), I decided to go along and post a solution to your problem. Before you start copy/pasting, please keep in mind that the only way to learn properly is to make a genuine effort at attempting to solve this yourself.

Looking at your recent track of questions, you don't seem to be comfortable with the basics of the language, so I would start by reading the documentation and trying out simple examples before tackling a bigger problem like neural networks.. So learn how to use the basic constructs, create and manipulate matrices, load/save data, basic plotting, etc.. Your code has a number of problems. Aside from the obvious syntactic mistakes, the main issue is that the target is multi-class (not binary), so you need to either use 3 output nodes one for each class (called 1-of-N encoding), or use a single output node with a different activation function (something capable of more than just binary output -1/1 or 0/1) In the solution below, the network has the following structure: %# load your data input = 0.832 64.643 0.818 78.843 1.776 45.049 0.597 88.302 1.412 63.458 ; target = 0 0 1 0 0 1 0 1 0 0 0 1 0 0 1 ; %# some parameters LEARNING_RATE = 0.1; MAX_ITERATIONS = 100; MIN_ERROR = 1e-4; numInst numDims = size(input); numClasses = size(target,2); %# three output nodes connected to two-dimensional input nodes + biases weights = randn(numClasses, numDims+1); isDone = false; %# termination flag iter = 0; %# iterations counter while ~isDone iter = iter + 1; %# for each instance err = zeros(numInst,numClasses); for i=1:numInst %# compute output: Y = W*X + b, then apply threshold activation output = ( weights * input(i,:)';1 >= 0 ); %#' %# error: err = T - Y err(i,:) = target(i,:)' - output; %#' %# update weights (delta rule): delta(W) = alpha*(T-Y)*X weights = weights + LEARNING_RATE * err(i,:)' * input(i,:) 1; %#' end %# Root mean squared error rmse = sqrt(sum(err. ^2,1)/numInst); fprintf('Iteration %d: , ' repmat('%f ',1,numClasses) '\n', iter, rmse); %# termination criteria if ( iter >= MAX_ITERATIONS || all(rmse.

18 +1 for being waaay nicer than necessary. – Jonas Aug 11 '10 at 12:58 thanks a lot...but I am done with this question now....when I needed the soln, no one appeared here. But I must thank you for being so generous.

– user414981 Aug 12 '10 at 2:03 16 you're kidding right, after all the noise you made!? – Amro Aug 12 '10 at 2:28 6 @ishamahajan: I gave you quite a few positive responses pointing out the errors in your code and giving you numerous links to the documentation. If you thought that we were just here to do your homework for you, then you are mistaken about what this site is for.

We're here to help you solve your problems. – gnovice Aug 12 '10 at 16:48 6 @user414981, 1) You didn't do your work on time at T-3 you asked for help.2) You got help but not the help you wanted.3) At T+3 help arrived, but you ignored it because it was too late. What need to be learned: 1) If you got help, show proper gratitude.2) Start earlier with your homework.

3) Great coders have become great coders because they have learned from their experiences. – Gamecat Dec 9 '10 at 11:50.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions