tôi có hiệu quả đào tạo rất khác với các mạng sauMô phỏng patternnet mặc định với feedforwardnet trong Matlab?
net = patternnet(hiddenLayerSize);
và sau một
net = feedforwardnet(hiddenLayerSize, 'trainscg');
net.layers{1}.transferFcn = 'tansig';
net.layers{2}.transferFcn = 'softmax';
net.performFcn = 'crossentropy';
trên cùng một dữ liệu.
Tôi đã nghĩ mạng phải giống nhau.
Tôi quên gì?
CẬP NHẬT
Đoạn code dưới đây cho thấy, rằng hành vi của mạng duy nhất phụ thuộc vào chức năng tạo mạng.
Mỗi loại mạng được chạy hai lần. Điều này không bao gồm các vấn đề máy phát ngẫu nhiên hoặc một cái gì đó. Dữ liệu giống nhau.
hiddenLayerSize = 10;
% pass 1, with patternnet
net = patternnet(hiddenLayerSize);
net.divideParam.trainRatio = 70/100;
net.divideParam.valRatio = 15/100;
net.divideParam.testRatio = 15/100;
[net,tr] = train(net,x,t);
y = net(x);
performance = perform(net,t,y);
fprintf('pass 1, patternnet, performance: %f\n', performance);
fprintf('num_epochs: %d, stop: %s\n', tr.num_epochs, tr.stop);
% pass 2, with feedforwardnet
net = feedforwardnet(hiddenLayerSize, 'trainscg');
net.layers{1}.transferFcn = 'tansig';
net.layers{2}.transferFcn = 'softmax';
net.performFcn = 'crossentropy';
net.divideParam.trainRatio = 70/100;
net.divideParam.valRatio = 15/100;
net.divideParam.testRatio = 15/100;
[net,tr] = train(net,x,t);
y = net(x);
performance = perform(net,t,y);
fprintf('pass 2, feedforwardnet, performance: %f\n', performance);
fprintf('num_epochs: %d, stop: %s\n', tr.num_epochs, tr.stop);
% pass 1, with patternnet
net = patternnet(hiddenLayerSize);
net.divideParam.trainRatio = 70/100;
net.divideParam.valRatio = 15/100;
net.divideParam.testRatio = 15/100;
[net,tr] = train(net,x,t);
y = net(x);
performance = perform(net,t,y);
fprintf('pass 3, patternnet, performance: %f\n', performance);
fprintf('num_epochs: %d, stop: %s\n', tr.num_epochs, tr.stop);
% pass 2, with feedforwardnet
net = feedforwardnet(hiddenLayerSize, 'trainscg');
net.layers{1}.transferFcn = 'tansig';
net.layers{2}.transferFcn = 'softmax';
net.performFcn = 'crossentropy';
net.divideParam.trainRatio = 70/100;
net.divideParam.valRatio = 15/100;
net.divideParam.testRatio = 15/100;
[net,tr] = train(net,x,t);
y = net(x);
performance = perform(net,t,y);
fprintf('pass 4, feedforwardnet, performance: %f\n', performance);
fprintf('num_epochs: %d, stop: %s\n', tr.num_epochs, tr.stop);
Output sau:
pass 1, patternnet, performance: 0.116445
num_epochs: 353, stop: Validation stop.
pass 2, feedforwardnet, performance: 0.693561
num_epochs: 260, stop: Validation stop.
pass 3, patternnet, performance: 0.116445
num_epochs: 353, stop: Validation stop.
pass 4, feedforwardnet, performance: 0.693561
num_epochs: 260, stop: Validation stop.
Vui lòng xem cập nhật của tôi. 1-3 không thể là một lý do, vì kết quả được tái tạo trên nhiều lần chạy: 'patternnet' có hệ thống hoạt động tốt hơn (rõ ràng) cùng' feedforwardnet'. Vì vậy, lý do là (có lẽ) tôi khởi tạo 'feedforwardnet' khác nhau, Câu hỏi đặt ra là: sự khác biệt là gì. –
http://www.mathworks.com/help/nnet/ref/feedforwardnet.html và http://www.mathworks.com/help/nnet/ref/patternnet.html. feedforwardnet phổ biến hơn và dự định nhiều hơn cho các hàm xấp xỉ, trong khi patternnet là nhiều hơn để nhận dạng mẫu. –
Nếu dữ liệu nhiệm vụ của bạn phù hợp hơn với patternnet, thì patternnet sẽ hoạt động tốt hơn và nếu dữ liệu nhiệm vụ của bạn phù hợp hơn với feedforwardnet, thì feedforwardnet sẽ hoạt động tốt hơn. –