Since the deployment of our Neural Network is approaching, this week I started to learn some primary Pytorch related knowledge (because our project is implemented by Flask, and Flask is implemented by Python, so we use the Pytorch with the same implementation by Python for our NN).
But before learning about Pytorch, I found that I first need to understand what Neural Network is.
“Neural network” is an underlying model of artificial intelligence. Many complex applications (such as pattern recognition, automatic control) and advanced models (such as deep learning) are based on it. Learning artificial intelligence must start from it.
1.Perceptron
- Perceptron
Scientists have always hoped to simulate the human brain and create machines that can think. Why can people think? Scientists discovered that the reason lies in the human body’s neural network. Since the basis of thinking is neurons, if you can create artificial neurons, you can form an artificial neural network to simulate thinking. In the 1960s, the earliest “artificial neuron” model called “perceptron” was proposed, which is still in use today. - Examples of perceptrons
Let’s look at an example. The city is holding an annual video game exhibition, I can’t make up my mind whether to visit it on weekends. I decided to consider three factors.- Weather: Is it sunny on weekends?
- Companion: Can you find someone to go with?
- Price: Are the tickets affordable?
- This constitutes a perceptron. The above three factors are external input, and the final decision is the output of the sensor. If all three factors are Yes (represented by 1), the output is 1 (to visit); if they are all No (represented by 0), the output is 0 (not to visit).
2. Weight and Biases
Seeing this, you will definitely ask: If some factors are established and others are not established, what is the output? For example, the weather is good on weekends and the tickets are not expensive, but I can’t find my partner. Should I visit? In reality, various factors are rarely of equal importance: some factors are decisive factors, while others are secondary factors. Therefore, you can assign weights to these factors to represent their different importance.
3. Decision Model
A single perceptron constitutes a simple decision model, which is ready for use. In the real world, the actual decision model is much more complicated, and it is a multi-layer network composed of multiple perceptrons.
4. The Operation Process of the Neural Network
To build a neural network, three conditions need to be met.
Input and output
Weight (w) and Bias (b)
Structure of multilayer perceptron
Among them, the most difficult part is to determine the weight (w) and bias (b). So far, these two values have been given subjectively, but it is difficult to estimate their values in reality. There must be a way to find out.
This method is trial and error. Other parameters remain unchanged, and small changes in w (or b) are recorded as Δw (or Δb), and then observe any changes in the output. Repeat this process until we get the set of w and b corresponding to the most accurate output, which is the value we want. This process is called model training.
Therefore, the operation process of the neural network is as follows.
- Determine input and output
- Find one or more algorithms that can get output from the input
- Find a set of data sets with known answers to train the model and estimate w and b
- Once new data is generated and input into the model, the results can be obtained, and w and b are corrected at the same time.
I appreciate Michael Nielsen’s open-source textbook (Neural Networks and Deep Learning) for helping me. Of course, this blog is just my basic and primary understanding of NN. If there are some errors or miss, I hope I can correct them in the future.
Link for Neural Networks and Deep Learning:http://neuralnetworksanddeeplearning.com/index.html