2.4 Neural Networks: How AI Makes a Decision (AI Course Class 10)

In this tutorial, we will cover subunit 2.4 Artificial Neural Networks of Unit 2: Advanced Concepts of Modeling in AI of the AI-417 course for Class 10.

For Part 2.3: Sub-Categories of Supervised, Unsupervised & Deep Learning, click on the link below:
https://datasciencehorizon.com/2-3-sub-categories-of-supervised-unsupervised-deep-learning-ai-course-class-10/

What is a Neural Network?

Neural networks are loosely modelled after how neurons in the human brain behave. The key advantage of neural networks is that they are able to extract data features automatically, without needing input from the programmer. A neural network is essentially a system of organizing machine learning algorithms to perform certain tasks. It is a fast and efficient way to solve problems for which the dataset is very large, such as in images.

How a Neural Network is Structured?

A Neural Network is divided into multiple layers, and each layer is further divided into several blocks called nodes. Each node has its own task to accomplish, which is then passed to the next layer.

A Neural Network consists of an input layer, hidden layer(s) which perform computation using weights and biases on each node, and finally, an output layer where the information arrives after passing through these layers as shown in below image.

The Input Layer

The first layer of a Neural Network is known as the input layer. Its job is to acquire data and feed it to the Neural Network. No processing occurs at the input layer.

The Hidden Layer(s)

Next are the hidden layers, the layers where all the processing occurs. Their name means these layers are hidden and not visible to the user. Each node of a hidden layer has its own machine learning algorithm, which it executes on the data received from the input layer.

The hidden layer performs computation by means of weights and biases. Information passes from one layer to the next only after the value found from this calculation passes through a selected activation function.

The process of finding the right output begins with trial and error, until the network finally learns. With each try, the weights are adjusted based on the error found between the desired output and the network’s actual output.

There can be multiple hidden layers in a neural network, and their number depends on the complexity of the function the network is configured for. The number of nodes in each layer can also vary.

The Output Layer

The last hidden layer passes the final processed data to the output layer, which then presents it to the user as the final output. Like the input layer, the output layer does not process the data it acquires, it’s meant purely for the user interface.

Real-world Applications of Neural Networks

  • Facial Recognition, click here to learn in detail.
  • Customer support chatbots
  • Malaria Cell Detection, click here to learn in detail.
  • Toxicity Classification, click here to learn in detail.
  • Voice Assistants, like Alexa, Siri and many more.

How Does AI Make a Decision?

Let’s say you want to go out to the park today. What would your thought process be? What would you consider?

Most of us would want to avoid getting soaked in the rain. These are possible factors that may influence your decision on whether to go out:

  • Should I bring a rain jacket?
  • Should I bring an umbrella?
  • Is it sunny now?
  • What will the weather be like later in the day?

Now you have the factors that will influence your decision to go out. But not all factors are equal, some are more important than others.

Ranking the Factors

Let’s rank them from most important to least important. For example, “is it sunny now” might be more important than “the weather forecast later,” and “having a jacket” might be more important than “having an umbrella.” This ranking is personal, everyone weighs these factors a little differently.

Converting This to a Perceptron

Now let’s convert this into a “perceptron”. Going back to our example, we have four inputs, let’s draw the perceptron with four inputs, X1 through X4:

X1: Do I have a jacket?
X2: Do I have an umbrella?
X3: Is it sunny now?
X4: What is the weather forecast for later?

Next, we have their weights, W1 through W4. Then we also have the bias, B, with its own weight, WB. Finally, we sum them all up, compare the total with a threshold, and get our output, as shown in above image.

Where do the weight values come from?

We never know the exact right values for the weights, but we can make assumptions based on:

  • Experience: For example, someone may have learned that a sunny morning usually means a bright day ahead, and weight that factor more heavily.
  • Personal preference: One person may judge a particular factor more heavily than another person would.

The value of WB (the bias weight) is also based on personal preference. A cautious person may set WB higher, so their decision leans toward staying indoors unless they’re sure it won’t rain. A more daring person will set a lower WB, making them more likely to go out regardless of the current situation. In our example, we’ll choose WB = 4, since we want to be more cautious.

There is no right or wrong answer when it comes to choosing weight values, but the values chosen will determine the outcome. That’s exactly why two people can look at the same situation and reach completely different decisions.

Worked Example 1: Going Out

Let’s say: I have a jacket, I don’t have an umbrella, it is sunny now, and the forecast says it’s going to rain later. We convert yes/no to 1s and 0s, and for bias, we always take 1.

From this calculation, the output is 0.5. Since this is higher than the threshold (which is zero), the result is: I will go out to the park.

Worked Example 2: Staying In

Now let’s change the example. Say: I don’t have a jacket, I have an umbrella, it is not sunny now, and the weather forecast is okay. We convert yes/no to 1s and 0s the same way, and bias stays at 1.

From this calculation, the output is -0.5. Since this is lower than the threshold (zero), the result is: I will not go out to the park.

Notice: it’s the exact same perceptron, with the exact same weights, only the inputs changed, and that alone flipped the decision. This is exactly how a trained neural network makes decisions on brand-new data.

Test Yourself

  1. Artificial neural networks are inspired by the structure and function of what?
  2. What is the process of adjusting the weights in a neural network to improve performance called?
  3. What is a neural network with multiple layers of interconnected neurons called?
  4. What kinds of tasks are neural networks particularly well-suited for?
  5. Assertion: Information processing in a neural network relies on weights and biases assigned to nodes.          Reasoning: These weights and biases determine how strongly a node is influenced by its inputs and its overall contribution to the next layer. Are both statements true, and does the reasoning correctly explain the assertion?

Stay Tuned!!

Stay tuned for next chapter, where we cover Model Evaluation in detail.

Click below for the YouTube video for Part 4 of Unit 2:

For any queries and clarification, kindly email us at datasciencehorizon@gmail.com

Keep learning and keep implementing!!

Leave a Comment

Your email address will not be published. Required fields are marked *