该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
close all
clear all
clc
a=x;
b=y;
inputs = a';
targets = b';
% 创建一个模式识别网络(两层BP网络),同时给出中间层神经元的个数,这里使用20
net=newff(inputs,targets,[25 25]);
net.trainParam.epochs=100;
net.trainParam.lr=0.01;
net.trainParam.goal=0.0001;
net.trainParam.max_fail=20;
% 对数据进行预处理,这里使用了归一化函数(一般不用修改)
% For a list of all processing functionstype: help nnprocess
net.inputs{1}.processFcns ={'removeconstantrows','mapminmax'};
% 把训练数据分成三部分,训练网络、验证网络、测试网络
% For a list of all data division functionstype: help nndivide
net.divideFcn = 'dividerand'; % Divide data randomly
net.divideMode = 'sample'; % Divide up every sample
net.divideParam.trainRatio = 70/100;</