For questions about the mathematics of artificial neural networks: their underlying multilayered graph object or their use as a data structure in machine learning algorithms. Consider also using the tags (machine-learning) or (graph-theory).

*Neural networks* (or commonly called artificial neural networks, or ANNs) are utilized in the fields of computer science and engineering in *machine learning* or *deep learning* algorithms. Technically the term *neural network* refers to the entire data structure, but because of their ubiquity the term neural network is often used to refer to the underlying weighted graph object too. Sometimes in papers you see it called a multilayer graph instead (a special case of a multipartite graph).

_{Image sourced from extremetech.com}

Essentially a neural network is a "chain" of complete bipartite graphs. The first layer of nodes in the chain is the *input layer*, the last is the *output layer*, and all the other nodes are in *hidden layers*. The big idea here is that a neural network is designed to simulate the way the human brain (a real neural networks) recognizes patterns. Because of this, neural networks are typically used in many pattern-recognition algorithms, like general handwriting recognition (when you can deposit a check by taking a picture of it), or facial recognition (when Facebook asks you to tag friends in a picture because it recognizes their face).

The common example used when explaining applications of ANNs is handwriting recognition. Adam Harley of Ryerson University created a beautiful online visualization of this example. Suppose someone writes a digit in the range [0, 1, ..., 9] and your ANN was trained to recognize what that digit is. First you codify the person's handwritten digit (make it into a black-and-white image and for each pixel use a zero if the pixel is black and a one if it's white, or something like that). This feeds into the *input layer* as the weights of those nodes. Then these initial input values are propagated through the ANN, being "*operated on*" by the weights of the edges and the nodes in the *hidden layers* (lots of details glossed over here). Then when the values arrive in the output layer, that output is compared to the set of expected output values to decide what the handwritten digit was. Since we have ten expected output values, our output layer would probably be set up with ten nodes, and we'd say, for example, that a value of (0,0,0,1,0,0,0,0,0,0) would be the expected output if the digit was three.

And of course how accurate this ANN is depends completely on the weights in the hidden layers. Prior to having a working ANN, you have to train it. To do this you get a large collection of input images (handwritten digits) for which you know what the output they are supposed to be. Then you feed the input through the ANN, look at the output and compare it to your expected output for that input. Using the differences between the output and the expected output, you *back-propagate* through the ANN and alter the weights to values that would have given a more accurate result. Changing these weights over a large collection of sample inputs essential *teaches* the network to accurately recognize patterns.