matlab神经网络预测图片含义,matlab神经网络预测(转自i lovematlab.cn)

matlab神经网络预测(转自i lovematlab.cn)

(2009-12-01 19:21:28)

标签:

杂谈

% 读入训练数据和测试数据

Input = [];

Output = [];

str = {'Test','Check'};

Data = textread([str{1},'.txt']);

% 读训练数据

Input = Data(:,1:end-1);

% 取数据表的前五列(主从成分)

Output = Data(:,end);

% 取数据表的最后一列(输出值)

Data = textread([str{2},'.txt']);

% 读测试数据

CheckIn = Data(:,1:end-1);

% 取数据表的前五列(主从成分)

CheckOut = Data(:,end);

% 取数据表的最后一列(输出值)

Input = Input';

Output = Output';

CheckIn = CheckIn';

CheckOut = CheckOut';

% 矩阵赚置

[Input,minp,maxp,Output,mint,maxt] = premnmx(Input,Output);

% 标准化数据

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% 神经网络参数设置

%====可以修正处

Para.Goal = 0.0001;

% 网络训练目标误差

Para.Epochs = 800;

% 网络训练代数

Para.LearnRate = 0.1;

% 网络学习速率

Para.Show = 5;

% 网络训练显示间隔

Para.InRange = repmat([-1 1],size(Input,1),1);

% 网络的输入变量区间

Para.Neurons = [size(Input,1)*2+1 1];

% 网络后两层神经元配置

Para.TransferFcn= {'logsig' 'purelin'};

% 各层的阈值函数

Para.TrainFcn = 'trainlm';

% 网络训练函数赋值

% traingd : 梯度下降后向传播法

% traingda : 自适应学习速率的梯度下降法

% traingdm : 带动量的梯度下降法

% traingdx : 带动量,自适应学习速率的梯度下降法

Para.LearnFcn = 'learngdm';

% 网络学习函数

Para.PerformFcn = 'sse';

% 网络的误差函数

Para.InNum = size(Input,1);

% 输入量维数

Para.IWNum = Para.InNum*Para.Neurons(1);

% 输入权重个数

Para.LWNum = prod(Para.Neurons);

% 层权重个数

Para.BiasNum = sum(Para.Neurons);

% 偏置个数

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Net = newff(Para.InRange,Para.Neurons,Para.TransferFcn,...

Para.TrainFcn,Para.LearnFcn,Para.PerformFcn);

% 建立网络

Net.trainParam.show = Para.Show;

% 训练显示间隔赋值

Net.trainParam.goal = Para.Goal;

% 训练目标误差赋值

Net.trainParam.lr = Para.LearnRate;

% 网络学习速率赋值

Net.trainParam.epochs = Para.Epochs;

% 训练代数赋值

Net.trainParam.lr = Para.LearnRate;

Net.performFcn = Para.PerformFcn;

% 误差函数赋值

% 调试

Out1 =sim(Net,Input);

% 仿真刚建立的网络

Sse1 =sse(Output-Out1);

% 刚建立的网络误差

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

[Net TR] = train(Net,Input,Output);

% 训练网络并返回

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Out3 =sim(Net,Input);

% 对学习训练后的网络仿真

分享:

a4c26d1e5885305701be709a3d33442f.png喜欢

0

a4c26d1e5885305701be709a3d33442f.png赠金笔

加载中,请稍候......

评论加载中,请稍候...

发评论

登录名: 密码: 找回密码 注册记住登录状态

昵   称:

评论并转载此博文

a4c26d1e5885305701be709a3d33442f.png

发评论

以上网友发言只代表其个人观点,不代表新浪网的观点或立场。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
新版Matlab中神经网络训练函数Newff的详细讲解-新版Matlab中神经网络训练函数Newff的使用方法.doc 本帖最后由 小小2008鸟 于 2013-1-15 21:42 编辑 新版Matlab中神经网络训练函数Newff的详细讲解 一、   介绍新版newffSyntax·          net = newff],{TF1 TF2...TFNl}, BTF,BLF,PF,IPF,OPF,DDF) Descriptionnewff],{TF1 TF2...TFNl}, BTF,BLF,PF,IPF,OPF,DDF) takes several arguments PR x Q1 matrix of Q1 sample R-element input vectorsTSN x Q2 matrix of Q2 sample SN-element target vectorsSiSize of ith layer, for N-1 layers, default = [ ]. TFiTransfer function of ith layer. (Default = 'tansig' for hidden layers and 'purelin' for output layer.)BTFBackpropagation network training function BLFBackpropagation weight/bias learning function IPFRow cell array of input processing functions. OPFRow cell array of output processing functions. DDFData divison function ExamplesHere is a problem consisting of inputs P and targets T to be solved with a network.·          P = [0 1 2 3 4 5 6 7 8 9 10];T = [0 1 2 3 4 3 2 1 2 3 4];Here a network is created with one hidden layer of five neurons.·          net = newff;The network is simulated and its output plotted against the targets.·          Y = sim;plotThe network is trained for 50 epochs. Again the network's output is plotted.·          net.trainParam.epochs = 50;net = train;Y = sim; plot 二、   新版newff与旧版newff调用语法对比 Example1比如输入input(6*1000),输出output为(4*1000),那么旧版定义:net=newff,[14,4],{'tansig','purelin'},'trainlm');新版定义:net=newff; Example2比如输入input(6*1000),输出output为(4*1000),那么旧版定义:net=newff,[49,10,4],{'tansig','tansig','tansig'},'traingdx');新版定义:net=newff; 更详细请看word文档 新版Matlab中神经网络训练函数Newff的使用方法.doc
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值