How to train feedforward network to solve XOR function
古いコメントを表示
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!
採用された回答
その他の回答 (4 件)
Albert
2013 年 2 月 16 日
0 投票
2 件のコメント
Greg Heath
2013 年 2 月 17 日
編集済み: Greg Heath
2013 年 2 月 17 日
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
2013 年 2 月 17 日
Sarita Ghadge
2017 年 9 月 15 日
0 投票
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
2024 年 5 月 21 日
0 投票
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
カテゴリ
ヘルプ センター および File Exchange で Deep Learning Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!