×

Neural Networks

Neural Networks are one of the most popular techniques and tools in Machine learning.

Neural Networks were inspired by the human brain as early as in the 1940s. Researchers studied the neuroscience and researched about the working of the human brain i.e. how the human brain learn and solve any particular problem and then applied the same idea to the computers.

In particular, if we look at the structure of a biological neural network, it seems something like this:

Neural Networks

Scientists observed that these neurons are connected and communicate with one another. They send electrical signals to one another, and these neurons process input signals and transmit the signal to other neurons in the future.

This biological idea is applied to the machine as well. We can design an Artificial Neural Network (ANN), which is a mathematical model for learning.

Artificial Neural Network is a computational model that can make some mathematical function that maps certain inputs to respective outputs based on the structure and parameters of the network.

In order to create our Artificial Neural Network like the biological neurons, there are units inside of a neural network which can be represented with a node in a graph also called neurons, and they can be connected to one another.

Neural Networks

Suppose we have two units that are connected to each other. Now, let's consider these artificial neurons as an input and output unit.

Neural Networks

Now, suppose we have to solve some problems by modeling some mathematical function. For example, we have to predict whether it will rain or not, and we have taken two variables x1 and x2, which represents two factors like temperature and humidity. Our task is to predict a Boolean Classification if it is going to rain or not.

Neural Networks

0= No Rain

1= Rain

So, for solving this task, let's define a Hypothesis function 'H' that takes an input x1 and x2. Based on these inputs, we have to determine whether it is going to rain or not. So, we can use the Linear combination of these inputs to model a mathematical function which determines the output.

H(x?, x?) = w? + w?x? + w?x?

H(x?, x?) = Hypothesis function with input variables x1 and x2.

w?, w? and w? are some weights (numbers).

Here, x1 and x2 are some inputs, and they are being multiplied by some weight (numbers) w1 and w2, respectively, and we add some bias weight, i.e., w0, which is used to bring the output value up or down.

So, In order to define the hypothesis function and get the output, we need to decide the values of these weights and do some sort of classification at the end, that whether it's raining or not raining and for that, we need to define some sort of function that defines some threshold value, and those functions are called Activation Functions.

Activation Functions

As explained above, to define the Hypothesis function and use it to determine whether it will rain or not, we need to create some threshold values based on the values produced. And Activation Functions are used to define those threshold values.

  1. Step Function- This function gives 0 when the value is less than some threshold value and 1 when the value is greater than the threshold value. i.e., 0 before reaching a particular threshold and 1 after reaching a particular threshold.
Neural Networks
  • Logistic Sigmoid Function- When we don't want purely binary results like 0 or 1, then we can use the Logistic function, which also gives in-between real values like the probability of rain is 0.5, and the probability of rain is 0.8. So, Logistic functions also give values between 0 and 1 instead of just a binary classification of 0 and 1.
Neural Networks
  • Rectified Linear Unit (ReLU) – It takes any input and takes the maximum value of that input and 0. So, this function always gives some positive value as an Output, and if the value is negative, it sets it to 0.
Neural Networks

There are other activation functions, as well. And whichever Activation function we use, its inputs are always multiplied by some weights and bias weight is also added, and some of those are used by activation function to figure out the output.

H(x?, x?) = g (w? + w?x? + w?x?)

Mathematically we can see an activation function as a function 'g,' which is applied to the result of the hypothesis function.

Neural Network Structure

The neural network structure is the graphical representation of the idea discussed above. The inputs are multiplied by some weights, and bias weight is added, and the whole sum is used by the function to provide some output.

Neural Networks

In the above figure, we can represent both the input variables x1 and x2 with the two units on the left and the unit on the right output. The edges connecting the inputs to the output have the weights associated with w1 and w2, respectively. And the output unit will calculate the output based on the input and weights by multiplying each weight with their respective input and adding some bias weight.

This is the graphical representation of the idea discussed above, and we call it a Neural Network Structure. The neural network will learn what should be the value of the weights and what the activation function should be to determine the output.

For Example, An OR Logical Function can be represented as function 'f.'

xyf(x, y)
 
000
011
101
111

Now, the question arises of how we can use this function to train the neural network and figure out the values of weights.

Neural Networks

Suppose we have taken w1 and w2 as 1 and w0 as -1 and defined the step function. And we are going to see the results for all the combinations of 0 and 1.

X1X2W1W2W0g(w0+x1w1+x2w2)Output
0011-1(-1+0+0) = -10
0111-1(-1+0+1) = 01
1011-1(-1+1+0) = 01
1111-1(-1+1+1) = 11

Here we can see input and output values are similar to the OR function.

Output when x1 and x2 are 0 and 1 respectively.

g (w? + w?x? + w?x?)

g (-1 + 1*0 + 1*1)

g (-1+0+1)

g (0)

g(0) lies at the threshold in the step function so, Output will be ‘1’.

We can also try AND function.

xyf(x, y)
 
000
010
100
111

The truth table of the AND function is shown above. Now we have to decide the values of w0, w1, and w2 so that values in the AND function can be satisfied.

Suppose w1 and w2 are 1 and w0 is -2.

Then,

X1X2W1W2W0g(w0+x1w1+x2w2)Output
0011-1(-2+0+0) = -10
0111-1(-2+0+1) = -10
1011-1(-2+1+0) = -10
1111-1(-2+1+1) = 01

In the above table, we can see that the above output is similar to the AND function.

So, the neural network should be able to determine what the weights should be in order to determine the output. And in Neural Network, we can also compose a more complex network and have as many input units as possible.

Neural Networks

The above representation allows us to represent problems with more number of inputs by growing the size of the neural network.

In the case of OR, AND function, it was easy to determine the values of weights but, now the question arises, How to calculate the weights in case of complex problems like when it's going to rain, or what is the price of the house etc. so, the method to do these complex calculation is called Gradient Descent.


Related Topics

The Wumpus World

The Wumpus world is a game playing which provides an environment to the knowledge-based agent to showcase its stored knowledge. It was developed by Gregory Yob in 1973. About the game:  It...

3 minutes read.

Gradient Descent

Gradient Descent When training a neural network, an algorithm is used to minimize the loss. This algorithm is called as Gradient Descent. And loss refers to the incorrect outputs given by...

6 minutes read.

Utility Functions in Artificial Intelligence

The agents use the utility theory for making decisions. It is the mapping from lotteries to the real numbers. An agent is supposed to have various preferences and can choose the one...

3 minutes read.

Dynamic Routing

Dynamic Routing Dynamic routing is used to update the routing table and find networks on the routers. It is easier than static routing and default routing, but it is more expensive in terms of...

3 minutes read.

Propositional Logic

It is a branch of logic which is also known as statement logic, sentential logic, zeroth-order logic, and many more. It works with the propositions and its logical connectivities. It deals with the...

5 minutes read.

Natural Language Processing

Natural Language Processing in AI Topics Covered in Language Module Natural Language ProcessingSyntax and SemanticsContext-Free GrammarNLTKN-gramsTokenizationBag of WordsNaïve Bayes In language, we will cover how Artificial Intelligence is used to process human language...

13 minutes read.

Problem-solving in Artificial Intelligence

The reflex agents are known as the simplest agents because they directly map states into actions. Unfortunately, these agents fail to operate in an environment where the mapping is too large to...

7 minutes read.

Heuristic Functions in Artificial Intelligence

Heuristic Functions in AI: As we have already seen that an informed search make use of heuristic functions in order to reach the goal node in a more prominent way....

3 minutes read.

Artificial Satellites

Many objects like stars, satellites and the moon are visible in the night sky. Satellites are objects revolving around the planet or a more significant object. Moon is the most...

6 minutes read.

Backward Chaining in AI: Artificial Intelligence

Backward Chaining is a backward approach which works in the backward direction. It begins its journey from the back of the goal. Like, forward chaining, we have backward chaining for Propositional logic as...

6 minutes read.

Top 10 Artificial Intelligence Technologies in 2024

Artificial Intelligence Technologies in 2020 1. Augmented Reality This is one of the most fascinating technology nowadays. Augmented Reality is the use of text, graphics, audio, etc. in real time. In Simple...

4 minutes read.

Hidden Markov Models

Hidden Markov Model is a partially observable model, where the agent partially observes the states. This model is based on the statistical Markov model, where a system being modeled follows the Markov process...

4 minutes read.

Classical Planning

Classical Planning is the planning where an agent takes advantage of the problem structure to construct complex plans of an action. The agent performs three tasks in classical planning: Planning: The agent plans after...

4 minutes read.

Supervised Learning in AI

Supervised Learning in AI Learning Supervised LearningClassification TasksNearest Neighbor ClassificationK nearest neighbor AlgorithmPerceptron LearningSupport Vector MachineRegression TasksLoss FunctionOverfittingRegularizationScikit LearnK Nearest Neighbor ImplementationPerceptron Algorithm ImplementationSupport Vector Machine Algorithm ImplementationRegression Implementation Machine Learning In the Artificial...

33 minutes read.

Inference Rules in Proposition Logic

Inference rules are those rules which are used to describe certain conclusions. The inferred conclusions lead to the desired goal state. In propositional logic, there are various inference rules which can be applied to...

3 minutes read.

Reinforcement Learning in AI

Reinforcement Learning in AI Reinforcement LearningMarkov’s Decision ProcessQ leaningGreedy Decision MakingNIM GameNIM Game Implementation with Python Reinforcement Learning Reinforcement Learning is about learning from experience, where agents are given a set of rewards...

15 minutes read.

Alpha-beta Pruning | Artificial Intelligence

Alpha-beta pruning is an advance version of MINIMAX algorithm. The drawback of minimax strategy is that it explores each node in the tree deeply to provide the best path among all the...

3 minutes read.

Information Retrieval

Information Retrieval: In order to analyze and categorize the text, we'd like to be able to figure out information about the text, some meaning about the text as well. And,...

14 minutes read.

Artificial Intelligence vs. Machine learning

Artificial Intelligence This word is trending in the world of technology. Artificial means something which was not present naturally, and it is built by humans, and intelligence means the ability to...

4 minutes read.

Resolution Method in AI

Resolution Method in AI Resolution method is an inference rule which is used in both Propositional as well as First-order Predicate Logic in different ways. This method is basically used for proving the...

5 minutes read.