# Neural Networks

 Revision as of 23:20, 26 February 2011 (view source)Ang (Talk | contribs)← Older edit Latest revision as of 19:38, 6 April 2013 (view source)Wikiroot (Talk | contribs) Line 11: Line 11: This "neuron" is a computational unit that takes as input $x_1, x_2, x_3$ (and a +1 intercept term), and This "neuron" is a computational unit that takes as input $x_1, x_2, x_3$ (and a +1 intercept term), and - outputs $h_{W,b}(x) = f(W^Tx) = f(\sum_{i=1}^3 W_{i}x_i +b)$, where $f : \Re \mapsto \Re$ is + outputs $\textstyle h_{W,b}(x) = f(W^Tx) = f(\sum_{i=1}^3 W_{i}x_i +b)$, where $f : \Re \mapsto \Re$ is called the '''activation function'''.  In these notes, we will choose called the '''activation function'''.  In these notes, we will choose $f(\cdot)$ to be the sigmoid function: $f(\cdot)$ to be the sigmoid function: Line 31: Line 31: - +
The $\tanh(z)$ function is a rescaled version of the sigmoid, and its output range is The $\tanh(z)$ function is a rescaled version of the sigmoid, and its output range is $[-1,1]$ instead of $[0,1]$. $[-1,1]$ instead of $[0,1]$. - Note that unlike CS221 and (parts of) CS229, we are not using the convention + Note that unlike some other venues (including the OpenClassroom videos, and parts of CS229), we are not using the convention here of $x_0=1$.  Instead, the intercept term is handled separately by the parameter $b$. here of $x_0=1$.  Instead, the intercept term is handled separately by the parameter $b$. Line 52: Line 53: A neural network is put together by hooking together many of our simple A neural network is put together by hooking together many of our simple - neurons,'' so that the output of a neuron can be the input of another.  For + "neurons," so that the output of a neuron can be the input of another.  For example, here is a small neural network: example, here is a small neural network: Line 58: Line 59: In this figure, we have used circles to also denote the inputs to the network.  The circles In this figure, we have used circles to also denote the inputs to the network.  The circles - labeled +1'' are called '''bias units''', and correspond to the intercept term. + labeled "+1" are called '''bias units''', and correspond to the intercept term. The leftmost layer of the network is called the '''input layer''', and the The leftmost layer of the network is called the '''input layer''', and the rightmost layer the '''output layer''' (which, in this example, has only one rightmost layer the '''output layer''' (which, in this example, has only one Line 94: Line 95: In the sequel, we also let $z^{(l)}_i$ denote the total weighted sum of inputs to unit $i$ in layer $l$, In the sequel, we also let $z^{(l)}_i$ denote the total weighted sum of inputs to unit $i$ in layer $l$, - including the bias term (e.g., $z_i^{(2)} = \sum_{j=1}^n W^{(1)}_{ij} x_j + b^{(1)}_i$), so that + including the bias term (e.g., $\textstyle z_i^{(2)} = \sum_{j=1}^n W^{(1)}_{ij} x_j + b^{(1)}_i$), so that $a^{(l)}_i = f(z^{(l)}_i)$. $a^{(l)}_i = f(z^{(l)}_i)$. Line 101: Line 102: to apply to vectors in an element-wise fashion (i.e., to apply to vectors in an element-wise fashion (i.e., $f([z_1, z_2, z_3]) = [f(z_1), f(z_2), f(z_3)]$), then we can write $f([z_1, z_2, z_3]) = [f(z_1), f(z_2), f(z_3)]$), then we can write - Equations~(\ref{eqn-network331a}-\ref{eqn-network331d}) more + the equations above more compactly as: compactly as: :\begin{align} :[itex]\begin{align} Line 109: Line 110: h_{W,b}(x) &= a^{(3)} = f(z^{(3)}) h_{W,b}(x) &= a^{(3)} = f(z^{(3)}) \end{align} \end{align}[/itex] - More generally, recalling that we also use $a^{(1)} = x$ to also denote the values from the input layer, + We call this step '''forward propagation.'''  More generally, recalling that we also use $a^{(1)} = x$ to also denote the values from the input layer, then given layer $l$'s activations $a^{(l)}$, we can compute layer $l+1$'s activations $a^{(l+1)}$ as: then given layer $l$'s activations $a^{(l)}$, we can compute layer $l+1$'s activations $a^{(l+1)}$ as: :\begin{align} :[itex]\begin{align} Line 120: Line 121: We have so far focused on one example neural network, but one can also build neural We have so far focused on one example neural network, but one can also build neural - networks with other {\bf + networks with other '''architectures''' (meaning patterns of connectivity between neurons), including ones with multiple hidden layers. - architectures} (meaning patterns of connectivity between neurons), including ones with multiple hidden layers. + The most common choice is a [itex]\textstyle n_l-layered network The most common choice is a $\textstyle n_l$-layered network where layer $\textstyle 1$ is the input layer, layer $\textstyle n_l$ is the output layer, and each where layer $\textstyle 1$ is the input layer, layer $\textstyle n_l$ is the output layer, and each layer $\textstyle l$ is densely connected to layer $\textstyle l+1$.  In this setting, to compute the layer $\textstyle l$ is densely connected to layer $\textstyle l+1$.  In this setting, to compute the output of the network, we can successively compute all the activations in layer output of the network, we can successively compute all the activations in layer - $\textstyle L_2$, then layer $\textstyle L_3$, and so on, up to layer $\textstyle L_{n_l}$, using Equations~(\ref{eqn-forwardprop1}-\ref{eqn-forwardprop2}).  This is one + $\textstyle L_2$, then layer $\textstyle L_3$, and so on, up to layer $\textstyle L_{n_l}$, using the equations above that describe the forward propagation step.  This is one example of a '''feedforward''' neural network, since the connectivity graph example of a '''feedforward''' neural network, since the connectivity graph does not have any directed loops or cycles. does not have any directed loops or cycles. - %We will write $\textstyle s_l$ to denote the - %number of units in layer $\textstyle l$ of the network (not counting the bias unit). Line 144: Line 142: patient, and the different outputs $y_i$'s might indicate presence or absence patient, and the different outputs $y_i$'s might indicate presence or absence of different diseases.) of different diseases.) + + + {{Sparse_Autoencoder}} + + + {{Languages|神经网络|中文}}