How to train feedforward network to solve XOR function
Afficher commentaires plus anciens
im new in matlab, please sorry if its stupid question. and sorry my english.
trying to train feedforward network to solve XOR function
1 hidden layer with 2 neurons, other settings are default: TANSIG, Backprop, TRAINLM, LEARNGDM, MSE
R2012b matlab version
close all, clear all, clc, format compact
p = [0 1 0 1 ; 0 0 1 1];
t = [0 1 1 0];
net = feedforwardnet(2,'trainlm');
net = train(net,p,t);
a = net(p)
ive tried this code, and tried 'nntool' and 'nnstart' too. its always seems like training algorithm splits 'p' set for
2 - training set,
1 - validation set,
1 - testing set
as a result - network is training on partial data (2 pair of digits instead 4), and training process generates Validation done or Minimum gradient reached (1.00e-010) in very few iteration (1-10 iterations) and simulation shows that network untrained.
- Is my guess right (about splitting 'p' set)?
- how i can manually give validation data (input and output sets) to training algorithm?
- should i somehow expand 'p' and 't' sets, and then use divideblock?
- any other ideas?
thanx!
Réponse acceptée
Plus de réponses (4)
Albert
le 16 Fév 2013
0 votes
2 commentaires
Greg Heath
le 17 Fév 2013
Modifié(e) : Greg Heath
le 17 Fév 2013
Never use max_fail above 10.
Do you understand it's function?
You don't need to change min_grad ... Something else is wrong.
Albert
le 17 Fév 2013
Albert
le 17 Fév 2013
0 votes
Sarita Ghadge
le 15 Sep 2017
0 votes
clc; close all; clear all;
P=[0 0 1 1; 0 1 0 1]; T=[0 1 1 0];
net= feedforwardnet(200);% 200-hidden layer
net.trainFcn = 'trainbr';
net.divideFcn = 'dividetrain';
[net, tr]= train(net,P,T)
a=net(P(:,1))
a=net(P(:,2))
a=net(P(:,3))
a=net(P(:,4))
it works for exor using feedforwardnet with >=150 hidden layer
ga
le 21 Mai 2024
0 votes
Train the neural network using a two-input XOR gate knowing the initial values:
w1 = 0.9;
w2 = 1,8;
b = - 0.9;
Requirements achieved:
Analyze the steps to train a perceptron neural network.
Training programming using Matlab software.
Use nntool for survey and analysis
Catégories
En savoir plus sur Deep Learning Toolbox dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!