function [net,tr,out3,out4,out5,out6]=train(net,varargin)
%TRAIN Train a neural network.
%
% [NET,TR] = <a href="matlab:doc train">train</a>(NET,X,T) takes a network NET, input data X
% and target data T and returns the network after training it, and a
% a training record TR.
%
% [NET,TR] = <a href="matlab:doc train">train</a>(NET,X) takes only input data, in cases where
% the network's training function is unsupervised (i.e. does not require
% target data).
%
% [NET,TR] = <a href="matlab:doc train">train</a>(NET,X,T,Xi,Ai,EW) takes additional optional
% arguments suitable for training dynamic networks and training with
% error weights. Xi and Ai are the initial input and layer delays states
% respectively and EW defines error weights used to indicate
% the relative importance of each target value.
%
% <a href="matlab:doc train">train</a> calls the network training function NET.<a href="matlab:doc nnproperty.net_trainFcn">trainFcn</a> with the
% parameters NET.<a href="matlab:doc nnproperty.net_trainParam">trainParam</a> to perform training. Training functions
% may also be called directly.
%
% <a href="matlab:doc train">train</a> arguments can have two formats: matrices, for static
% problems and networks with single inputs and outputs, and cell arrays
% for multiple timesteps and networks with multiple inputs and outputs.
%
% The matrix format is as follows:
% X - RxQ matrix
% Y - UxQ matrix.
% Where:
% Q = number of samples
% R = number of elements in the network's input
% U = number of elements in the network's output
%
% The cell array format is most general:
% X - NixTS cell array, each element X{i,ts} is an RixQ matrix.
% Xi - NixID cell array, each element Xi{i,k} is an RixQ matrix.
% Ai - NlxLD cell array, each element Ai{i,k} is an SixQ matrix.
% Y - NOxTS cell array, each element Y{i,ts} is a UixQ matrix.
% Xf - NixID cell array, each element Xf{i,k} is an RixQ matrix.
% Af - NlxLD cell array, each element Af{i,k} is an SixQ matrix.
% Where:
% TS = number of time steps
% Ni = NET.<a href="matlab:doc nnproperty.net_numInputs">numInputs</a>
% Nl = NET.<a href="matlab:doc nnproperty.net_numLayers">numLayers</a>,
% No = NET.<a href="matlab:doc nnproperty.net_numOutputs">numOutputs</a>
% ID = NET.<a href="matlab:doc nnproperty.net_numInputDelays">numInputDelays</a>
% LD = NET.<a href="matlab:doc nnproperty.net_numLayerDelays">numLayerDelays</a>
% Ri = NET.<a href="matlab:doc nnproperty.net_inputs">inputs</a>{i}.<a href="matlab:doc nnproperty.input_size">size</a>
% Si = NET.<a href="matlab:doc nnproperty.net_layers">layers</a>{i}.<a href="matlab:doc nnproperty.layer_size">size</a>
% Ui = NET.<a href="matlab:doc nnproperty.net_outputs">outputs</a>{i}.<a href="matlab:doc nnproperty.output_size">size</a>
%
% The error weights EW can be 1, indicating all targets are equally
% important. It can also be either a 1xQ vector defining relative sample
% importances, a 1xTS cell array of scalar values defining relative
% timestep importances, an Nox1 cell array of scalar values defining
% relative network output importances, or in general an NoxTS cell array
% of NixQ matrices (the same size as T) defining every target element's
% relative importance.
%
% The training record TR is a structure whose fields depend on the network
% training function (net.NET.<a href="matlab:doc nnproperty.net_trainFcn">trainFcn</a>). It may include fields such as:
% * Training, data division, and performance functions and parameters
% * Data division indices for training, validation and test sets
% * Data division masks for training validation and test sets
% * Number of epochs (num_epochs) and the best epoch (best_epoch).
% * A list of training state names (states).
% * Fields for each state name recording its value throughout training
% * Performances of the best network (best_perf, best_vperf, best_tperf)
%
% Here a static feedforward network is created, trained on some data, then
% simulated using SIM and network notation.
%
% [x,t] = <a href="matlab:doc simplefit_dataset">simplefit_dataset</a>;
% net = <a href="matlab:doc feedforwardnet">feedforwardnet</a>(10);
% net = <a href="matlab:doc train">train</a>(net,x,t);
% y1 = <a href="matlab:doc sim">sim</a>(net,x)
% y2 = net(x)
%
% Here a dynamic NARX network is created, trained, and simulated on
% time series data.
%
% [X,T] = <a href="matlab:doc simplenarx_dataset">simplenarx_dataset</a>;
% net = <a href="matlab:doc narxnet">narxnet</a>(1:2,1:2,10);
% <a href="matlab:doc view">view</a>(net)
% [Xs,Xi,Ai,Ts] = <a href="matlab:doc preparets">preparets</a>(net,X,{},T);
% net = <a href="matlab:doc train">train</a>(net,Xs,Ts,Xi,Ai);
% Y = net(Xs,Xi,Ai)
%
% <strong>Training with Parallel Computing</strong>
%
% Parallel Computing Toolbox allows Neural Network Toolbox to train
% networks faster and on larger datasets than can fit on one PC.
%
% (Parallel and GPU training are currently supported for backpropagation
% training only, i.e. not Self-Organizing Maps.
%
% Here training automatically happens across MATLAB parallel workers.
%
% parpool
% [X,T] = vinyl_dataset;
% net = feedforwardnet(140,'trainscg');
% net = <a href="matlab:doc train">train</a>(net,X,T,'UseParallel','yes');
% Y = net(X,'UseParallel','yes');
%
% Use Composite values to distribute the data manually, and get back
% the results as a Composite value. If the data is loaded as it is
% distributed then while each piece of the dataset must fit in RAM, the
% entire dataset is only limited by the number of workers RAM. Use
% the function <a href="matlab:doc configure">configure</a> to prepare a network for training
% with parallel data.
%
% net = feedforwardnet(140,'trainscg');
% net = configure(net,X,T);
% Xc = Composite;
% Tc = Composite;
% for i=1:numel(Xc)
% Xc{i} = X+rand(size(X))*0.1; % (Use real data instead
% Tc{i} = T+rand(size(T))*0.1; % instead of random data)
% end
% net = <a href="matlab:doc train">train</a>(net,Xc,Tc);
% Yc = net(Xc);
% Y = cat(2,Yc{:});
%
% Networks can be trained using the current GPU device, if it is
% supported by the Parallel Computing Toolbox. This is efficient for
% large static problems or dynamic problems with many series.
%
% net = feedforwardnet(140,'trainscg');
% net = <a href="matlab:doc train">train</a>(net,X,T,'UseGPU','yes');
% Y = net(X,'UseGPU','yes');
%
% If a network is static (no delays) and has a single input and output,
% then training can be done with data already converted to gpuArray form,
% if the network is configured with MATLAB data first.
%
% net = feedforwardnet(140,'trainscg');
% net = configure(net,X,T);
% Xgpu = gpuArray(X);
% Tgpu = gpuArray(T);
% net = <a href="matlab:doc train">train</a>(net,Xgpu,Tgpu);
% Ygpu = net(Xgpu);
% Y = gather(Ygpu);
%
% To run in parallel, with workers associated with unique GPUs taking
% advantage of that hardware, while the rest of the workers use CPUs:
%
% net = feedforwardnet(140,'trainscg');
% net = <a href="matlab:doc train">train</a>(net,X,T,'UseParallel','yes','UseGPU','yes');
% Y = net(X,'UseParallel','yes','UseGPU','yes');
%
% Only using workers with unique GPUs may result in higher speed, as CPU
% workers may not keep up.
%
% net = feedforwardnet(140,'trainscg');
% net = <a href="matlab:doc train">train</a>(net,X,T,'UseParallel','yes','UseGPU','only');
% Y = net(X,'UseParallel','yes','UseGPU','only');
%
% Use the 'ShowResources' option to verify the computing resources used.
%
% net = train(...,'ShowResources','yes');
%
% <strong>Training Safely with Checkpoint Files</strong>
%
% The optional parameter CheckpointFile allows
没有合适的资源?快使用搜索试试~ 我知道了~
元神经网络训练train函数
共1个文件
m:1个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 68 浏览量
2022-07-08
22:47:55
上传
评论
收藏 5KB ZIP 举报
温馨提示
BP(back propagation)神经网络是1986年由Rumelhart和McClelland为首的科学家提出的概念,是一种按照误差逆向传播算法训练的多层前馈神经网络,是目前应用最广泛的神经网络。 BP神经网络的计算过程由正向计算过程和反向计算过程组成。正向传播过程,输入模式从输入层经隐单元层逐层处理,并转向输出层,每一层神经元的状态只影响下一层神经元的状态。如果在输出层不能得到期望的输出,则转入反向传播,将误差信号沿原来的连接通路返回,通过修改各神经元的权值,使得误差信号最小。 1.网络状态初始化 2.前向计算过程
资源推荐
资源详情
资源评论
收起资源包目录
3900841.zip (1个子文件)
train.m 16KB
共 1 条
- 1
资源评论
GZM888888
- 粉丝: 121
- 资源: 2902
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 信息办公个人求职管理系统-jobgljsp.rar
- 信息办公一流网络JSP网络管理系统 v1.0-yljsp10.rar
- chirpstack学习
- 管家婆辉煌、财贸、工贸、服装,食品,千方模拟狗
- 基于python开发的工业环境老鼠检测+源码+文档(毕业设计&课程设计&项目开发)
- USB转以太网的芯片SR9900全套设计资料包括(参考设计原理图PCB+ Linux -Windows驱动程序+量产工具)
- 信息办公XML考试系统-xmlks.rar
- 基于python开发的无人机图像目标检测+实验数据+开发文档+操作流程+源码(毕业设计&课程设计&项目开发)
- 全球智能商品管理与优化系统
- IDM下载器(电脑小工具)
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功