MATLAB 神经网络函数
MATLAB 神经网络函数
1.首先打开神经网络拟合GUI(nnstart)
2.点击 fitting app,进入主窗口
3.网络创建 数据获取
4.导入数据(这里是导入的matlab自身的数据)
下面就可以进行样本分配
5.进行网络结构设置
分为三部分:Hidden Layer,Recommendation,Neural Network
6.这一步就可以进行对数据的网络训练
7.继续对它进行神经网络训练
8.对它进行回归分析,R值分析,期望
9.继续对它进行误差分析,得到柱状图
10.继而对它进行网络评定
11.最后对它进行结果保存
保存的脚本文件如下:
1.Simple Script
% Solve an Input-Output Fitting problem with a Neural Network
% Script generated by Neural Fitting app
% Created 28-Mar-2022 16:05:51
%
% This script assumes these variables are defined:
%
% abaloneInputs - input data.
% abaloneTargets - target data.x = abaloneInputs;
t = abaloneTargets;% Choose a Training Function
% For a list of all training functions type: help nntrain
% 'trainlm' is usually fastest.
% 'trainbr' takes longer but may be better for challenging problems.
% 'trainscg' uses less memory. Suitable in low memory situations.
trainFcn = 'trainlm'; % Levenberg-Marquardt backpropagation.% Create a Fitting Network
hiddenLayerSize = 10;
net = fitnet(hiddenLayerSize,trainFcn);% Setup Division of Data for Training, Validation, Testing
net.divideParam.trainRatio = 70/100;
net.divideParam.valRatio = 15/100;
net.divideParam.testRatio = 15/100;% Train the Network
[net,tr] = train(net,x,t);% Test the Network
y = net(x);
e = gsubtract(t,y);
performance = perform(net,t,y)% View the Network
view(net)% Plots
% Uncomment these lines to enable various plots.
%figure, plotperform(tr)
%figure, plottrainstate(tr)
%figure, ploterrhist(e)
%figure, plotregression(t,y)
%figure, plotfit(net,x,t)
2.Advanced Script
% Solve an Input-Output Fitting problem with a Neural Network
% Script generated by Neural Fitting app
% Created 28-Mar-2022 16:18:23
%
% This script assumes these variables are defined:
%
% abaloneInputs - input data.
% abaloneTargets - target data.x = abaloneInputs;
t = abaloneTargets;% Choose a Training Function
% For a list of all training functions type: help nntrain
% 'trainlm' is usually fastest.
% 'trainbr' takes longer but may be better for challenging problems.
% 'trainscg' uses less memory. Suitable in low memory situations.
trainFcn = 'trainlm'; % Levenberg-Marquardt backpropagation.% Create a Fitting Network
hiddenLayerSize = 10;
net = fitnet(hiddenLayerSize,trainFcn);% Choose Input and Output Pre/Post-Processing Functions
% For a list of all processing functions type: help nnprocess
net.input.processFcns = {'removeconstantrows','mapminmax'};
net.output.processFcns = {'removeconstantrows','mapminmax'};% Setup Division of Data for Training, Validation, Testing
% For a list of all data division functions type: help nndivision
net.divideFcn = 'dividerand'; % Divide data randomly
net.divideMode = 'sample'; % Divide up every sample
net.divideParam.trainRatio = 70/100;
net.divideParam.valRatio = 15/100;
net.divideParam.testRatio = 15/100;% Choose a Performance Function
% For a list of all performance functions type: help nnperformance
net.performFcn = 'mse'; % Mean Squared Error% Choose Plot Functions
% For a list of all plot functions type: help nnplot
net.plotFcns = {'plotperform','plottrainstate','ploterrhist', ...'plotregression', 'plotfit'};% Train the Network
[net,tr] = train(net,x,t);% Test the Network
y = net(x);
e = gsubtract(t,y);
performance = perform(net,t,y)% Recalculate Training, Validation and Test Performance
trainTargets = t .* tr.trainMask{1};
valTargets = t .* tr.valMask{1};
testTargets = t .* tr.testMask{1};
trainPerformance = perform(net,trainTargets,y)
valPerformance = perform(net,valTargets,y)
testPerformance = perform(net,testTargets,y)% View the Network
view(net)% Plots
% Uncomment these lines to enable various plots.
%figure, plotperform(tr)
%figure, plottrainstate(tr)
%figure, ploterrhist(e)
%figure, plotregression(t,y)
%figure, plotfit(net,x,t)% Deployment
% Change the (false) values to (true) to enable the following code blocks.
% See the help for each generation function for more information.
if (false)% Generate MATLAB function for neural network for application% deployment in MATLAB scripts or with MATLAB Compiler and Builder% tools, or simply to examine the calculations your trained neural% network performs.genFunction(net,'myNeuralNetworkFunction');y = myNeuralNetworkFunction(x);
end
if (false)% Generate a matrix-only MATLAB function for neural network code% generation with MATLAB Coder tools.genFunction(net,'myNeuralNetworkFunction','MatrixOnly','yes');y = myNeuralNetworkFunction(x);
end
if (false)% Generate a Simulink diagram for simulation or deployment with.% Simulink Coder tools.gensim(net);
end
MATLAB 神经网络函数相关推荐
- Matlab神经网络函数newff()新旧用法差异
声明!!!转载自: http://www.cnblogs.com/xxfcz/p/4482813.html 摘要 在Matlab R2010a版中,如果要创建一个具有两个隐含层.且神经元数分别为5.3 ...
- matlab newff函数弃用了,MATLAB神经网络函数NEWFF()新旧用法差异
摘要 在Matlab R2010a版中,如果要创建一个具有两个隐含层.且神经元数分别为5.3的前向BP网络,使用旧的语法可以这样写: net1 = newff(minmax(P), [5 3 1]); ...
- matlab newff函数弃用了,[转载]MATLAB神经网络函数NEWFF()新旧用法差异
摘要 在Matlab R2010a版中,如果要创建一个具有两个隐含层.且神经元数分别为5.3的前向BP网络,使用旧的语法可以这样写: net1 = newff(minmax(P), [5 3 1]); ...
- matlab神经网络函数
1.设计函数 solvein 设计线性网络: solverb 设计径向基网络: solverbe 设计精确的径向 ...
- matlab神经网络函数(feedforwardnet,fitnet,patternet)
feedforwardnet (): 综述:包含一系列的层次.第一层与网络输入连接.接下来的层次与上一次连接.最后一层产生网络的输出.feedforward网络可以用作输入和输出的映射,只含有一个隐含 ...
- matlab feedforward,matlab神经网络函数feedforwardnet构造的网络数学模型是啥
clc;clear all;close %% 线性系统x(k+1)=A*x(k)+B*u(k)参数(A,B) A=[1 1;-1 1]; B=[0.1; 1]; %% 神经网络训练参数 N=1000; ...
- MATLAB中内置的BP神经网络函数 help newff翻译【学习笔记】
MATLAB中内置的BP神经网络函数 help翻译 原文请参考:help newff newff 创建前馈反向传播网络. 在 R2010b NNET 7.0 中已过时. 最后在 R2010a NNET ...
- matlab 有理逼近,BP神经网络函数逼近
模糊神经网络函数逼近 ====比较简单,直接贴出来就好 % 利用BP网络实现函数逼近 clear % NEWFF--生成一个新的前向神经网络 %TRAIN---对BP网络进行训练 % SIM----对 ...
- 理解神经网络函数高频成分的收敛率界限
©作者 | 王志伟.罗涛.许志钦 单位 | 上海交通大学 神经网络的频率原则 深度神经网络(DNN)在监督学习问题上展现出了其广泛的应用前景.近期的一系列的研究表明,神经网络的输出关于频率存在一种隐式 ...
- matlab神经网络应用设计 源代码,MATLAB神经网络应用设计
合理.完善的知识体系结构:内容丰富,重点突出,应用性强:免费提供相关程序源代码下载:深入.详细剖析MATLAB工程应用技术. ¥68.64定价:¥226.56(3.03折) 2009-09-01 神经 ...
最新文章
- 问题1:U盘可以识别但无法打开;问题2:U盘成为启动盘之后如何恢复成普通U盘。
- 中文发音关系频谱的猜想
- 内部类不能有静态变量(除静态的对Static的理解)
- 高职学计算机专业排名,海南雅典职业技术学校官网
- 计算机基础应用的培养活动记录,计算机应用基础综合实训
- mysql isnull
- php 接收传值_PHP在函数体中传递与接收参数
- python字典元素的值是否相等_对Python中等值和大小比较
- shell-6:shell中的计算$((1+1))
- Solidity基础入门知识---函数的访问权限和可见性
- C机顶盒开发实战常量定义方式、结构定义方式(可理解为对象Model)
- 从月收入8000元到15000元,你和LabVIEW编程高手的差距到底在哪?
- 计算机期末考试方案,初中信息技术期末考试方案.doc
- C语言实现一个矩阵乘法计算器
- 请简述计算机主板的基本组成部分,科技知识:计算机主板的基本组成部分
- LaTeX 文字带边框
- 高等数学基础知识点 导数与微分 思维导图
- 微场景:移动互联时代的营销革命
- [Python] 随机抽样
- stm32f103mini IO