Artificial intelligence and machine learning aren't just grabbing headlines and making blockbuster movies. They are poised to bring big changes to our daily lives, such as self-driving cars and life-saving medical equipment. In fact, according to the Global Big Data Conference, AI is “totally reshaping life science, medicine, and healthcare,” and is also transforming voice-activated assistants, image recognition, and many other popular technologies. .
Artificial intelligence is a term that refers to machines that can be used to interpret data, learn from it, and perform tasks similar to those performed by humans. Machine learning is a branch of artificial intelligence that focuses on training machines to learn on their own without much supervision.
What is a neural network? If you are unfamiliar with these terms, this neural networks tutorial will help you better understand these concepts.
Let's start this neural network tutorial by understanding “What is a neural network?”
What is a neural network?
You probably already use neural networks on a daily basis. When you ask a mobile assistant like Google, Siri, or Amazon Web to search for you, or use a self-driving car, it's all done by neural networks. Computer games also use neural networks on the backend as part of the game system to adjust to the player. Maps applications likewise process map images to help you find the fastest way to reach your destination.
A neural network is a system or hardware designed to behave like the human brain.
Neural networks can perform the following tasks:
- translate text
- identify faces
- recognize voice
- read handwritten text
- control robot
- Many other
Let's continue this neural network tutorial by understanding how neural networks work.
How neural networks work
Neural networks are usually described as having different layers. The first layer is the input layer, which takes the input signal and passes it to the next layer. The next layer does all kinds of calculations and feature extraction. This is called a hidden layer. There are often multiple hidden layers. And finally, there is an output layer that provides the final result.
Let's look at a real-world example of how traffic cameras identify license plates and speeding vehicles on the road. The image itself is 28 x 28 pixels, and the image is provided as input to identify the license plate. Each neuron has a number, called an activation, that represents the grayscale value of the corresponding pixel, ranging from 0 to 1. White pixels are 1, black pixels are 0. Each neuron lights up when its activation is close to 1.
Pixels in array format are fed into the input layer. If your image is larger than 28 x 28 pixels, you can't resize the input layer and will need to scale it down. In this example, name the inputs X1, X2, and X3. Each of these represents one of the incoming pixels. The input layer then passes the input to the hidden layer. Interconnections are randomly assigned weights. The weights are multiplied by the input signal and a bias is added to all weights.
The weighted sum of inputs is fed as input to the activation function, which determines which nodes are activated for feature extraction. As the signal flows through the hidden layers, a weighted sum of the inputs is computed and fed into each layer's activation function to determine which nodes to activate.
Master deep learning, machine learning, and other programming languages with the Artificial Intelligence Engineer Master's degree program.
Let's take a detour and examine the neural network activation function. There are many different types of activation functions.
-
sigmoid function
The sigmoid function is used when the model predicts probabilities.
-
threshold function
Threshold functions are used when you do not want to worry about intermediate uncertainties.
-
ReLU (modified linear unit) function
The ReLU (modified linear unit) function gives a value of 1 if it is greater than 1 and 0 if it is less than 0. The ReLU function is most commonly used these days.
-
hyperbolic tangent function
The hyperbolic tangent function is similar to the sigmoid function, but it ranges from -1 to 1.
Now that we understand what an activation function is, let's get back to neural networks. Finally, the model predicts the outcome and applies the appropriate application function to the output layer. In the car image example, optical character recognition (OCR) is used to convert the image to text and identify what is written on the license plate. Although the neural network example shows only three incoming dots, eight hidden layer nodes, and one output, there are actually a huge number of inputs and outputs.
Errors in the output are backpropagated through the network and weights are adjusted to minimize the error rate. This is calculated by a cost function. Continue adjusting the weights until they fit all of the different training models you have set up.
The output is then compared to the original result and multiple iterations are performed to maximize accuracy. At each iteration, the weights of each interconnect are adjusted based on the error. This calculation is complex and will not be explained in detail here. However, we will see how it is done while running the code for the use case.
In the next section of the Neural Networks tutorial, let's take a look at the types of neural networks.
Types of neural networks
The different types of neural networks are discussed below.
-
feedforward neural network
This is the simplest form of ANN (Artificial Neural Network). Data is sent in only one direction (input to output). This is the example we saw earlier. When you actually use it, it's fast. When training, it takes time. Almost all visual and speech recognition applications use some form of this type of neural network.
-
Radial basis function neural network
This model classifies data points based on their distance from a central point. For example, if you don't have training data, you'll need to group things together to create center points. Networks find data points that are similar to each other and group them together. One application for this is power recovery systems.
-
Kohonen Self-Organizing Neural Network
A vector of random inputs is input into a discrete map made up of neurons. Vectors are also called dimensions or planes. Applications include using it to recognize patterns in data such as medical analytics.
-
Recurrent Neural Network
In this type, the hidden layer stores its output for use in future predictions. The output becomes part of the new input. The application includes text-to-speech conversion.
-
convolutional neural network
In this type, the input features are retrieved in batches as if passing through a filter. This allows the network to remember parts of the image. Applications include signal and image processing such as facial recognition.
-
modular neural network
It consists of a collection of different neural networks working together to obtain an output. This is cutting edge and still in the research phase.
The next section of the Neural Networks tutorial provides an example of how to use neural networks.
Neural networks – use cases
Let's use this system to tell the difference between cats and dogs. Our problem statement is that we want to use a neural network to classify pictures of dogs and cats. The sample images feature a variety of dogs and cats, and it's pretty amazing just to line them up!
Coding language and environment
Build a neural network and implement your use case in Python (version 3.6). Start by importing the required packages using Keras.
Let's talk about the environment we're working in. When you visit the official Keras website, the first thing you will notice is that Keras runs on his TensorFlow, CNTK, or Theano. TensorFlow is probably one of the most widely used packages in Keras.
Keras is user-friendly, modular, and extensible. It also works with Python. This is important because many people in the data science field are using Python these days. When using Keras, you can add layers one after the other, each containing different information, which makes Keras powerful and fast.
Side note: I used Anaconda with Python built in and created my own package called keraspython36. If you frequently experiment with different packages, you may want to create your own environment there.
In Anaconda Navigator, keraspython36 is listed under Environment.[ホーム]Start Jupyter Notebook from the menu and make sure you are using the correct environment you just set up. You can use any setup editor you're comfortable with, but this example uses Python and Jupyter Notebook.
conclusion
So, using Python, they successfully built a neural network that can distinguish between pictures of cats and dogs. Just imagine all the other things you can distinguish and the different industries you can use it to enter. What an exciting time to be able to play with these tools.
If you have any questions about neural network tutorials, please visit SimpliLearn. You can also send us the data used here in a zip folder. Want to learn more about neural networks and artificial intelligence? Check out Simplilearn's introduction to artificial intelligence for beginners. Already in the AI field but want to further your career? Become an Artificial Intelligence Engineer through Simplilearn's master's program.