24.07.2016 Views

www.allitebooks.com

Learning%20Data%20Mining%20with%20Python

Learning%20Data%20Mining%20with%20Python

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 11<br />

Each of these issues has been addressed in recent times, leading to a resurgence<br />

in popularity of neural networks. Computational power is now much more easily<br />

available than 30 years ago, and advances in algorithms for training mean that we<br />

can now readily use that power.<br />

Intuition<br />

The aspect that differentiates deep neural networks from the more basic neural<br />

network we saw in Chapter 8, Beating CAPTCHAs with Neural Networks, is size.<br />

A neural network is considered deep when it has two or more hidden layers. In<br />

practice, a deep neural network is often much larger, both in the number of nodes<br />

in each layer and also the number of layers. While some of the research of the mid-<br />

2000s focused on very large numbers of layers, smarter algorithms are reducing the<br />

actual number of layers needed.<br />

A neural network basically takes very basic features as inputs—in the case of<br />

<strong>com</strong>puter vision, it is simple pixel values. Then, as that data is <strong>com</strong>bined and pushed<br />

through the network, these basic features <strong>com</strong>bine into more <strong>com</strong>plex features.<br />

Sometimes, these features have little meaning to humans, but they represent the<br />

aspects of the sample that the <strong>com</strong>puter looks for to make its classification.<br />

Implementation<br />

Implementing these deep neural networks can be quite challenging due to their size.<br />

A bad implementation will take significantly longer to run than a good one, and may<br />

not even run at all due to memory usage.<br />

A basic implementation of a neural network might start by creating a node<br />

class and collecting a set of these into a layer class. Each node is then connected<br />

to a node in the next layer using an instance of an Edge class. This type of<br />

implementation, a class-based one, is good to show how networks work,<br />

but is too inefficient for larger networks.<br />

Neural networks are, at their core, simply mathematical expressions on matrices.<br />

The weights of the connections between one network and the next can be<br />

represented as a matrix of values, where the rows represent nodes in the first layer<br />

and the columns represent the nodes in the second layer (the transpose of this matrix<br />

is used sometimes too). The value is the weight of the edge between one layer and<br />

the next. A network can then be defined as a set of these weight matrices. In addition<br />

to the nodes, we add a bias term to each layer, which is basically a node that is<br />

always on and connected to each neuron in the next layer.<br />

[ 247 ]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!