![]() |
[求助]怎么做sequential mode network
希望有高手可以指点一下,在做一道题目要求用sequential mode模拟一条曲线。 一般用batch mode还可以,sequential mode 有点没头绪了,特别是要求用50个neuron 的时候得到的曲线我觉得不太对。
------------------------------------------------------------------------------------------------------------------------------------- clc; clear; close all; %Generating training data and desired output x=-1:0.05:1; y=0.8*sin(2*pi*x)+cos(pi*x); % Test the MLP, net_output is the output of the MLP, ytest is the desired output. xtest=(2*rand(1,100)-1); %generate randon value from -1 to 1 xtest=sort(xtest','ascend')'; ytest=0.8*sin(2*pi*xtest)+cos(pi*xtest); %define hidden neurons n=[1 2 3 4 5 6 7 8 9 10 50]; for j=1:length(n); %Create network net=newff(minmax(x),[n(j),1],{'tansig' 'purelin'},'trainlm'); %Train the MLP net.adaptFcn = 'trains'; % Specify the sequential training net.adaptParam.passes = 1000; % Specify the number of epoch for i = 1 : length(x) % Convert the input and output data NP{i} = x(i); % into cell array NY{i} = y(i); end net = adapt(net,NP,NY); net_output=sim(net,xtest); % Plot out the test results figure; plot(xtest,ytest,'ro'); hold on; plot(xtest,net_output,'b-'); hold off end |
所有时间均为北京时间。现在的时间是 11:13。 |
Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.