1.前文

    The following topics explain how to use graphical tools for training neural networks to solve problems in function fitting, pattern recognition, clustering, and time series. Using these tools can give us an excellent introduction to the use of the Neural Network
Toolbox software:
• “Fit Data with a Shallow Neural Network” 
• “Classify Patterns with a Shallow Neural Network” 
• “Cluster Data with a Self-Organizing Map” 
• “Shallow Neural Network Time-Series Prediction and Modeling” 

2.浅层神经网络进行数据拟合

2.1 GUI的方法

command-line:nnstart

LOAD chemical_dataset.MAT loads these two variables:
chemicalInputs - a 8x498 matrix defining measurements taken from eight sensors during a chemical process.
chemicalTargets - a 1x498 matrix of a ninth sensor's measurements, to be estimated from the first eight.
A good estimator for the ninth sensor will allow it to be removed and estimations used in its place.
[X,T] = chemical_dataset loads the inputs and targets into variables of your own choosing.     
Select a training algorithm, then click Train. Levenberg-Marquardt (trainlm) is recommended for most problems, but for some noisy and small problems Bayesian Regularization (trainbr) can take longer but obtain a better solution. For large problems, however, Scaled Conjugate Gradient (trainscg) is recommended as it uses gradient calculations which are more memory efficient than the Jacobian calculations the other two algorithms use. This example uses the default LevenbergMarquardt.
The regression plots display the network outputs with respect to targets for training, validation, and test sets. For a perfect fit, the data should fall along a 45 degree line, where the network outputs are equal to the targets. For this problem, the fit is reasonably good for all data sets, with R values in each case of 0.93 or above. If even more accurate results were required, you could retrain the network by clicking Retrain in nftool. This will change the initial weights and biases of the network, and may produce an improved network after retraining. Other options are provided on the following
The histogram can give you an indication of
outliers, which are data points where the fit is significantly worse than the majority of data. 
如果训练集误差比较大,应该是网络太小了,增加层数或者每层的神经元数;
如果测试集的误差比较大,应该就是过拟合。
利用工具箱生成自动生成代码:

2.2 代码驱动

% Solve an Input-Output Fitting problem with a Neural Network
% Script generated by NFTOOL
% houseInputs - input data.
% houseTargets - target data.
inputs = houseInputs;
targets = houseTargets;
% Create a Fitting Network
hiddenLayerSize = 10;
net = fitnet(hiddenLayerSize);
% Set up 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,inputs,targets);
% Test the Network
outputs = net(inputs);
errors = gsubtract(outputs,targets);
performance = perform(net,targets,outputs);
% View the Network
view(net)
% Plots
% Uncomment these lines to enable various plots.
figure, plotperform(tr)
figure, plottrainstate(tr)
%figure, plotfit(targets,outputs)
figure, plotregression(targets,outputs)
figure, ploterrhist(errors)

matlab神经网络2:数据拟合相关推荐

  1. 基于Matlab平台的BP神经网络进行数据拟合

    基于Matlab平台的BP神经网络进行数据拟合 上次讨论了基于Hopfield神经网络的数字识别,BP(Back Propagation)神经网络也可以进行相关的数字识别如手写数字识别等,由于BP神经 ...

  2. 基于MATLAB的多项式数据拟合方法研究-毕业论文

    摘要:本论文先介绍了多项式数据拟合的相关背景,以及对整个课题做了一个完整的认识.接下来对拟合模型,多项式数学原理进行了详细的讲解,通过对文献的阅读以及自己的知识积累对原理有了一个系统的认识.介绍多项式 ...

  3. matlab神经网络预测数据,matlab神经网络工具箱

    什么是matlab神经网络 Matlab语言是MathWorks公司推出的一套高性能计算机编程语言,集数学计算.图形显示.语言设计于一体,其强大的扩展功能为用户提供了广阔的应用空问. 它附带有30多个 ...

  4. matlab神经网络求解最优化,matlab神经网络训练数据

    1.神经网络的准确率是怎么计算的? 其实神经网络的准确率的标准是自己定义的. 我把你的例子赋予某种意义讲解: 1,期望输出[1 0 0 1],每个元素代表一个属性是否存在.像着4个元素分别表示:是否肺 ...

  5. 【Matlab基础】数据拟合

    目录 一.线性拟合 1. 常用辅助函数 2. 多元线性拟合 例子: 二.多项式拟合 三.lsqcurvefit函数 例子1: 例子2: 四.nlinfit非线性拟合 例子1: 例子2: 五.其他拟合函 ...

  6. (一)MATLAB数学建模——数据拟合

    目录 一.简介 二.多项式拟合 (一)指令介绍 (二)代码 三.指定函数拟合 (一)指令介绍 (二)代码 一.简介 曲线拟合也叫曲线逼近,主要要求拟合的曲线能合理反映数据的基本趋势,而不一定要求曲线一 ...

  7. matlab 3维 数据拟合,利用matlab将三维数据拟合成三维曲线

    拟合三维曲线貌似可以用相信回归做,但是matlab有一个自带的polyfit函数,可以直接算出二维数据的拟合曲线,用的是最小二乘法的思想. 思路其实很简单,将两条拟合的二维曲线组合在一起就是三维曲线了 ...

  8. 神经网络控制与matlab仿真,matlab神经网络拟合预测

    matlab中如何用神经网络求得数据拟合函数? 谷歌人工智能写作项目:小发猫 用MATLAB神经网络进行函数拟合后,拟合的函数表达式有吗? 常见的神经网络结构. 神经网络一般是没有表达式的哈,但是只要 ...

  9. matlab数据拟合工具箱的应用(转载)

    数据拟合工具箱笔记 在matlab中做数据拟合是非常常见的事,而又以多项式拟合最为常用,下面简单介绍一下常见的多项式拟合的方法: 多项式拟合 1. 多项式拟合命令 x=[1 2 3 4 5 6 7 8 ...

最新文章

  1. EOJ Monthly 2018.1
  2. Struts 2:處理一個form多個submit
  3. Windows环境下MySQL 5.7的安装、配置与卸载
  4. 2010年北京大学计算机研究生机试真题
  5. Mysql 数据插入 修改删除
  6. lisp语言是最好的语言_Lisp可能不是数据科学的最佳语言,但是我们仍然可以从中学到什么呢?...
  7. 再添一所!华中科技大学成立人工智能与自动化学院
  8. 《ELK Stack权威指南(第2版)》一3.5 Windows系统日志
  9. QNX系统获取PPS属性值
  10. 用u盘进不了pe计算机意外地,u盘装系统启动不了无法进入pe怎么办
  11. 计算机专业专硕考研数学考一还是二,计算机专业考研数学考一还是二
  12. GC overhead limit exceeded问题
  13. 应急响应--windows主机入侵排查思路
  14. ESP32开发日志之AiThinkerIDE_V1.0使用过程中的一个问题
  15. 美丽诗文背诵-未完待续
  16. 2022到2023基于java+微信小程序毕业设计课题参考
  17. 2021-06-29 连续非空子序列
  18. python 字符串的输入和输出
  19. 基于SSM实现的人力资源管理系统【附源码】(毕设)
  20. APS科普:如何缩短制造提前期?

热门文章

  1. CHIL-SQL-PRIMARY KEY 约束
  2. jQuery处理点击父级checkbox所有子级checkbox都选中,取消选中所有子级checkbox都取消...
  3. jQuery实战读书笔记(第五章)
  4. Css3-锚链接和伪类tartet
  5. 图解 CSS (9): 列表
  6. 开始一瓢凉水浇顶,然后慢慢的感觉良好。
  7. ubuntu16.04 编译opencv4和opencv_contrib
  8. Merge into 用法
  9. 使用WSW将Nginx创建为Windows系统服务
  10. 初学WPF之程序启动几种方式