Home > Backend Development > Python Tutorial > What is a neural network?

What is a neural network?

小云云
Release: 2017-12-23 16:02:27
Original
4271 people have browsed it

The term deep learning refers to training neural networks. Deep represents very large neural networks. So what exactly is a neural network? After reading this article, you will have a very intuitive understanding. This article mainly introduces a simple understanding of what a neural network is, which has certain reference value. Friends in need can refer to it.

Let’s start with an example of house price prediction. Because house prices are so damn expensive now, my parents asked me to help me buy a house in Beijing 8 years ago. I felt that I couldn’t rely on my family, so I refused. Thinking about it now, I am a fool. I bought it at that time. There is no need to write a blog now~~

It is said that housing prices are speculated by the Chinese themselves, but in addition to speculation, there are still some real factors that affect housing prices. By analyzing these factors Through analysis, we can predict housing prices. Suppose you have a data set (size and price of six houses). You want to find a way (i.e. build a function) to predict price from area. If you are familiar with linear regression (it doesn’t matter if you are not familiar, just think of it as a mathematical theory), then you can draw a straight line near the actual data based on this theory, such as the red line in the picture above, and the blue line near it The small circles represent the points where the area of ​​the six houses corresponds to the housing price. That is, using this line (this function) to find the housing price corresponding to a certain area, it is basically accurate except for some errors. In addition, we know that the price will never be negative, unless you are a gangster, occupying other people's houses and asking others to give you money. Therefore, when the area is zero, the price is also zero, so the straight line above takes a turn. You can think of the above function that predicts price based on area as a very simple neuron network (this is almost the simplest neuron network). As shown in the picture on the right, the yellow circle is a neuron, and the size of the house is x. It enters this neuron as input, and then the neuron outputs the house price y.

In neural network related literature, you will often see this function (the red line above). This function is 0 for a certain period of time and then suddenly takes off and skyrockets. It is called a linear unit function (ReLU, full name: rectified linear unit). It doesn’t matter if you don’t understand it now, you will understand it later!

The above example of predicting housing prices by area is a neural network with a single neuron that is extremely small. By stacking multiple such neurons together, a larger neural network can be formed. You can think of a neuron as being like a building block, and you can get a larger neural network by stacking many of these building blocks together. As for the example of housing prices, as shown in the figure above, the factors that affect housing prices are not only the area, but also the number of bedrooms, for example. In addition to the size, the number of bedrooms also determines whether the house is suitable for your family, such as three or five people. Another factor is zip code. The postal code here represents the geographical location. If the geographical location is prosperous, life will be more convenient. Then another factor is the school quality level, which is known as the school district Fangyi in China. These factors are also called characteristics. Based on the area and number of bedrooms, it can be estimated whether it meets the family size. Based on the postal code, you can estimate the convenience of living, including the convenience of getting to school. Finally the school rating can assess the quality of education. People will consider these four factors when buying a house, that is, they determine the price, and damn hype. Let’s ignore the hype factor for now. So in this example, x represents these 4 inputs, and y is the price to be predicted. The picture on the left above is our manual analysis process. We analyze which inputs will affect the matching of family size, life convenience, and education quality, and then arrive at the price in mind. The magical thing about neural networks is that we only need to provide the input x (area, number of bedrooms...) and the desired result y (house price), as well as the real data used for training (the area of ​​the six houses above, the number of bedrooms) ...and price), then the family size matching, life convenience, and education quality in the middle part will be obtained by the neural network itself based on actual data training, as shown on the right. When you enter the characteristics of the seventh house again (area, zip code...), this neural network will give you the final house price based on the previously trained middle part. That is, the internal process of the neural network replaces the human analysis process. To give another example, when we teach children about cats, we bring some white cats and tell them that they are cats, then we bring some black cats and tell them that these are also cats, and then we bring some dogs and tell them that these are cats. It's not a cat. Finally, bring some tabby cats and ask him. He will tell you that they are cats, but how did he know? What is the intermediate judgment process like? we do not know. This is why neural networks are scary - they work so much like humans - we don't know how it works internally, that is, we don't know what it thinks, just like we don't know a child How to tell the difference between cats and dogs specifically. Musk is right when he says that artificial intelligence is dangerous and may destroy humanity.

The neurons in the middle part mentioned above are called hidden neurons. You may have noticed that in the neural network on the right, each hidden neuron receives all feature inputs. The picture on the left is our human analysis process. We analyzed that the two features of area and number of bedrooms are related to the size of the family. In the picture on the right, we provide all the features to each hidden neuron and let the neural network itself To analyze which characteristics will affect housing prices in what aspects. Maybe the analysis of neural networks is more efficient and comprehensive than that of humans. I have seen a piece of news before. Facebook’s neural network invented a communication method because it felt that communication in human language was too inefficient~~

Related recommendations:

How to use Python to implement a two-layer neural network and perceptron model

Detailed explanation of the theoretical basis of neural networks and Python implementation methods

JavaScript implements simple neural network algorithm graphic and text explanation

The above is the detailed content of What is a neural network?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template