How to create and train a perceptron

  • Permalink
  • submit to reddit
  • Email
  • Follow


Hy,
I've to create a perceptron and I tried with the followind code:

clc
clear all
close all
dati=xlsread('datilab5.xls','Sheet1','B2:AH2049');

p(1,:)=min(dati);
p(2,:)=max(dati);
p=p(:,1:32);
net=newp(p',32,'hardlim','learnp');
net.trainParam.epochs = 20;

P=dati(:,1:32);
T=dati(:,33);
net = train(net, P',T')


In the excel datasheet I've the data from the column 1 to 32 (these are 
the features) in 2048 rows and the check class for supervising in the 
column 33.

The fault is in the target matrix dimension but i donn't understand the 
problem source.
I read the newp help and S is the numeber neurons but this is for the 
number of input layer or number of output layer?
Thank you to everybody for suggests.
Bye


0
Reply sittinghorse (2) 12/2/2008 8:54:14 AM

See related articles to this posting

comp.soft-sys.matlab 201078 articles. 512 followers. Post

0 Replies
43 Views

Similar Articles

[PageSpeed] 51


Reply:

Similar Artilces:

sequence 3 tasks
Hello   i use a board 6023E and pc pentium4 3Ghz   My problem is how create a delay with few microseconds between two tasks?   I need creat three tasks. Fisrt create a finte pulse train for this i use a counter. Second create a delay for this i use again a conter to creat a pulse train in witch the delay is equal to frequency x number of pulses. Third measure pulses for this i use again a counter but in this case is a counter input. In attachment i send a picture with my program.   I dont understand why my program dont work? my program take a lote ...

Perceptron training question
Greetings, For an ANN course we got as homework to write code that trains a 2 inputs perceptron with AND/OR functions. I have seen in some books a simple algorithm that converges quickly (bipolar input and output, at each step correct weights for training inputs that don't produce the right result). However I had to implement a variation of this algorithm : binary input & output and at each step select a random training vector and adjust weights if the output is wrong. This worked too but now I have to improve this algorithm with a learning factor gamma and use this gamma and the sign...

create a perceptron in Matlab
Hy, I've to create a perceptron and I tried with the followind code: clc clear all close all dati=xlsread('datilab5.xls','Sheet1','B2:AH2049'); p(1,=min(dati); p(2,=max(dati); p=p(:,1:32); net=newp(p',32,'hardlim','learnp'); net.trainParam.epochs = 20; P=dati(:,1:32); T=dati(:,33); net = train(net, P',T') In the excel datasheet I've the data from the column 1 to 32 (these are the features) in 2048 rows and the check class for supervising in the column 33. The fault is in the target matrix dimension but i donn't understand ...

Creating/Calling NN Train Function
Hi all. I am creating a series of functions to implement a type of neural network. One of the functions is called to train the already created network. It is defined: function [best_net,best_tr]=AANN_train(net,Ptrain,Train,val,test,trials) .. .. .. Within that function, saved as an .m file called "AANN_train", is the call to the built-in neural network toolbox function "train": .. .. .. [net,tr] = train(net,Ptrain,Ttrain,[],[],val,test); .. .. .. But when I try to call my function AANN_train, I get an error message: [best_net,best_tr] = AANN_train(net,Ptrain,Trai...

Create a semi-random pulse train
Hi there! I'm trying to simulate a real-life situation for a Smart Grid system. I need to recognize a given pulse train in a transmission line and differentiate it from random pulses that also come at any given time in the line. The pulse train to be recognized is a simple 1:1 pulse train of say 5 pulses of same amplitude, 4 Ampere for example. I'm using the autocorrelation function to analyze the signal and see if the pulse trains distinctive triangle-shaped ACF is found. My problem right now is in the simulation of the random pulses that also come in the line, something li...

Can I create pulse train above 167s?
I need to generate pulse train with pulse width longer than 167.7 sec. using card 7030/6030E. Can anybody help me? Thanks The 167.7 sec limitation is caused by dividing 100 kHz by 2^24. So all you have to do is use two counters instead of one. Use the first counter to generate a pulse train slower than 100kHz and you can use the second counter to generate a very slow pulse train if you set its source to the out of the previous counter. You will have to use the pulse specs on the second counter, because it is going to be used to divide down the initial pulse train. I hope this helps. Jos...

Need some recomendations for creating training set.
Hello all. I am going to build a neural network for approximating a smooth continuous function. This function has values ranging from 0 to 100 (a percent of concentration). I have lots of training samples, where target concentration is 0% or 100% and much less trainig samples with intermediate concentration values. The amount of samples with target concentrations of 0% or 100% is about 9000-10000 times greater, than amount of samples with other target concentration values. For example, 10940 samples with target=0% 209 samples with target=1% .... 44 samples with target=12% .... 31 samples wit...

Suitable Training Algorithms for A Multilayer Perceptron Network
Hi, I am new to neural network. Recently, I have encountered a problem where I need to train a 2-nodes-hidden-layered MLP with 8 nodes on each layer and 5 input nodes and 2 output nodes. I have tried different parameters for Backpropagation algorithm and the best confusion matrix results I got is the following: a b <----classified as 30 17 a (true 0 245 b classes) The training data set contains 292 instances. I used the training data to test the network. I want to have 100% accuracy for my problem, because I want a perfect fit of the model to the data. Then I will extract ru...

creating one-off samples from full training set
Hii, I have a training dataset of size 1000*30 . I want it to train 10 different neural nets. Now I Do Not want to use the entire training dataset rather have different subsamples for each net. I am using probability measure to create such training samples. Example for net 1 I have probability of 0.60, implies each pattern of training set has 60 percent chance of being there in training sample of net 1, for net 2, prob = .5, implies 50% chances of each pattern being there in training sample of net 2. I do not how to implement this using NN toolbox. Kindly help me in doing so. Thanks ...