?? quickstart.tex
字號:
\documentclass{article}\newcommand{\toolboxname}{NetPack}\title{\toolboxname \\ Quick-start (command line)} \parindent 0cm\begin{document}\newcommand{\file}[1]{\texttt{#1}}\newcommand{\matlab}{Matlab}% begin definitie \tbcmd{\catcode`\}=12\catcode`\]=2\global\def\tbcmd#{\verb}\let\troep]]% eind definitie \tbcmd% begin definitie \mlcmd{\catcode`\}=12\catcode`\]=2\global\def\mlcmd#{\verb}\let\troep]]% eind definitie \mlcmd% begin definitie \seealso{\catcode`\}=12\catcode`\]=2\global\def\seealso#{\par See also: \verb}\let\troep]]% eind definitie \seealso% begin definitie environment example\newenvironment{example}{\redefxverbatim\begin{verbatim}}{\end{verbatim}}{\makeatletter\catcode`\/=0\catcode`\\=12/catcode`/{=12/catcode`/}=12/catcode`/[=1/catcode`/]=2/global/def/redefxverbatim[/def/@xverbatim##1\end{example}[##1/end[example]]]] % eind definitie environment example\maketitle%---------------------------------------------------------------------%---------------------------------------------------------------------\section{Before you begin}%---------------------------------------------------------------------Start \matlab\ and add initialize the toolbox. Thiscan be done by running the command \tbcmd{init_netpack_snn}.To do this, at the \matlab\ prompt type \begin{example}run(fullfile('NETPACKROOT', 'netpack', 'init_netpack_snn'));\end{example}where for NETPACKROOT you substitute the installation path of the\toolboxname\ toolbox (e.g. \file{/home/user/netpack-toolbox-1.1} or \file{C:$\backslash$netpack-toolbox-1.1}).\parFor (almost) all functions in the toolbox online help is available in\matlab\ by typing:\begin{example}help <function name>\end{example}where \verb|<function name>| is the name of the function you want informationon.%---------------------------------------------------------------------%---------------------------------------------------------------------\section{Training a neural network}%---------------------------------------------------------------------\subsection{Import training data}Training data can be read from file using the command\tbcmd{import_ascii_data_snn}, which reads an ascii file. This filemust contain columns with input and target values. The firstargument is the name of the file, the second and third argumentcontain column indices for inputs and targets.For example, the command\begin{example}wcf_data = import_ascii_data_snn('file.asc', 1, [2 3])\end{example}reads training patterns from the file \file{file.asc}, with inputsfrom the first column of the file, and outputs from the second andthird column. \seealso{wcfdata_struct_snn}\subsection{Create network}To define the architecture of your feed forward network, you use thecommand \tbcmd{net_struct_snn}, which takes three arguments; 1. anarray of integers with the number of units in each network layer. 2.a cell array with transfer function names for each layer. 3. the nameof a training algorithm.For example, \begin{example}net = net_struct_snn([1 8 2], {'tansigtf_snn' 'lintf_snn'}, 'trainlm_snn')\end{example}creates a network with an input layer with one input, one hidden layerwith 8 units and an output layer with two outputs. The hidden layerhas \mlcmd{tansigtf_snn} (a hyperbolic tangent sigmoid) as a transferfunction and the output layer has as transfer function\mlcmd{lintf_snn} (linear transfer). For training theLevenberg-Marquardt algorithm will be used (\tbcmd{trainlm_snn}).\seealso{transferfcn_snn, trainfcn_snn}\subsection{Train network}Training a network can be done with the command \tbcmd{train_snn}. Thefirst argument contains the network, the second argument the trainingdata. Optionally, a third argument can be specified containingvalidation data which is used to early stop training.For example,\begin{example}[net, tr_info] = train_snn(net, wcf_data)\end{example}\subsection{Use the network as an estimator}After training, the network can be used as an estimator. The command\tbcmd{simff_snn} takes as arguments the network and a matrix with ineach column an input pattern and returns a matrix with in each columnan estimate for the corresponding output.For example,\begin{example}x = [0:0.05:1]y = simff_snn(net, x)\end{example}%---------------------------------------------------------------------%---------------------------------------------------------------------\section{Ensembles}%---------------------------------------------------------------------To estimate confidence and prediction intervals, we use ensembles ofnetworks.\subsection{Train ensembles}An ensemble of networks can be created by training thenetworks on different subsets of the training data set and by trainingwith different initial connection weights. New initial connectionweights can be set with the command \tbcmd{reinitweights_snn}.Training on different subset is done with \tbcmd{train_bootstrap_snn}, whichtakes a bootstrap sample from the original data set to create newtraining and validation sets, or with \tbcmd{train_halfout_snn}, whichdivides the original data set at random in a training and a validation set of equal size. For example,\begin{example}for m = 1:10 net = reinitweights_snn(net); [nets(m), tr_info(m), datasets(m)] = train_bootstrap_snn(net, wcf_data)end\end{example}or\begin{example}for m = 1:10 net = reinitweights_snn(net); [nets(m), tr_info(m), datasets(m)] = train_halfout_snn(net, wcf_data)end\end{example}\subsection{Average ensembles}The estimates of the networks in the ensemble can be combined inseveral ways to give an averaged estimate. We use a technique called\emph{balancing}. In balancing we compute a weighted estimate depending on theoutput error functions. First, the weight of each network is computedwith \tbcmd{balance_snn}, which returns a bootstrap estimate of thenetwork weights.For example,\begin{example}bootn = 100;[network_weights, ym] = balance_snn(nets, bootn, datasets)\end{example}Then, for each input pattern a new averaged estimate can be computedwith \tbcmd{simff_avr_snn}.For example,\begin{example}[y_av, err_estimate] = simff_avr_snn(nets, network_weights, x)\end{example}\subsection{Estimate confidence intervals}Confidence intervals can be calculated with \tbcmd{confidence_snn},which makes an estimate of the lower and upper bound of the interval based on the weighted averaged error and$c_{confidence}$. The value of $c_{confidence}$ depends on thedesired confidence level 1 - $\alpha$, where $\alpha$ is the error level, andcan be calculated with \tbcmd{c_confidence_snn}.For example,\begin{example}error_level = 0.33c_confidence = c_confidence_snn(error_level, nets, wcf_data, network_weights)[ylc, yuc, y_av] = confidence_snn(c_confidence, nets, network_weights, x)\end{example}\subsection{Estimate prediction intervals}Prediction intervals are calculated with the command\tbcmd{prediction_snn}, which makes an estimate of the lower and upperbound of the interval based on $c_{prediction}$ and a (new) networkwhich gives a prediction of the output noise. This network and$c_{prediction}$ are calculated with \tbcmd{c_prediction_snn}.For example,\begin{example}[c_prediction, noise_net, tr_info] = ... c_prediction_snn(error_level, nets, datasets, network_weights)[ylp, yup, y_av] = ... prediction_snn(c_prediction, noise_net, nets, network_weights, x)\end{example}%---------------------------------------------------------------------\end{document}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -