Artificial Intelligence

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 67

Artificial intelligence

Artificial Intelligence is defined as a field of science and engineering that deals with

making intelligent machines or computers to perform human-like activities.

Mr. John McCarthy is known as the godfather of this amazing invention.

"A computer system able to perform tasks that normally require human intelligence,

such as visual perception, speech recognition, decision-making, and translation

between languages

Artificial Intelligence exists when a machine can have human based skills such

as learning, reasoning, and solving problems.

Why Artificial Intelligence?


Before Learning about Artificial Intelligence, we should know that what is the

importance of AI and why should we learn it. Following are some main reasons to

learn about AI:

● With the help of AI, you can create such software or devices which can solve
real-world problems very easily and with accuracy such as health issues,
marketing, traffic issues, etc.
● With the help of AI, you can create your personal virtual Assistant, such as
Cortana, Google Assistant, Siri, etc.
● With the help of AI, you can build such Robots which can work in an
environment where survival of humans can be at risk.

What is intelligence?
Intelligence is the 'ability to perceive or information, and to retain it as

knowledge to be applied towards adaptive behavior within an environment or

context.

Learning
There are a number of different forms of learning as applied to artificial
intelligence. The simplest is learning by trial and error. For example, a simple
computer program for solving mate-in-one chess problems might try moves at
random until mate is found. The program might then store the solution with the
position so that the next time the computer encountered the same position it would
recall the solution. This simple memorizing of individual items and
procedures—known as rote learning—is relatively easy to implement on a
computer.

Reasoning
Reasoning plays a great role in the process of artificial Intelligence. Thus Reasoning
can be defined as the logical process of drawing conclusions, making predictions or
constructing approaches towards a particular thought with the help of existing
knowledge. In artificial intelligence, reasoning is very important because to
understand the human brain, how the brain thinks, how it draws conclusions towards
particular things for all these sorts of works we need the help of reasoning.The most
significant difference between these forms of reasoning is that in the deductive case the truth
of the premises guarantees the truth of the conclusion, whereas in the inductive case the truth
of the premise lends support to the conclusion without giving absolute assurance.

Problem solving
Problem solving, particularly in artificial intelligence, may be characterized as a
systematic search through a range of possible actions in order to reach some
predefined goal or solution. Problem-solving methods divide into special purpose
and general purpose. A special-purpose method is tailor-made for a particular
problem and often exploits very specific features of the situation in which the
problem is embedded.
The Concepts of AI:
1. Artificial Intelligence
"Artificial Intelligence" refers to the simulation of human intelligence processes by
machines, especially computer systems. It also includes Expert systems, voice
recognition, machine vision, and natural language processing (NLP).

AI programming focuses on three cognitive aspects, such as learning, reasoning,


and self-correction.

● Learning Processes
● Reasoning Processes
● Self-correction Processes
● Learning Processes:This part of AI programming is concerned with
gathering data and creating rules for transforming it into useful information.
The rules, which are also called algorithms, offer computing devices with
step-by-step instructions for accomplishing a particular job.
● Reasoning Processes:This part of AI programming is concerned with
selecting the best algorithm to achieve the desired result.
● Self-Correction Processes:This part of AI programming aims to
fine-tune algorithms regularly in order to ensure that they offer the most
reliable results possible.

2.Machine Learning
Machine Learning is defined as the branch of Artificial Intelligence and computer
science that focuses on learning and improving the performance of
computers/machines through past experience by using algorithms.
AI is used to make intelligent machines/robots, whereas machine learning helps
those machines to train for predicting the outcome without human intervention.

How does Machine Learning work?


Machine Learning uses algorithms and techniques that enable the machines to learn
from past experience/trends and predict the output based on that data.However,
firstly, machine learning access a huge amount of data using data pre-processing.
This data can be either structured, semi-structured, or unstructured. Further, this
data is fed through some techniques and algorithms to machines, and then based on
previous trends; it predicts the outputs automatically.

Types of Machine Learning:

1.Supervised Machine Learning


This type of ML method uses labelled datasets to train machines and,
based on these datasets, machines predict the output. It needs
supervision to train models and predict outputs. Image segmentation,
medical diagnosis, fraud detection, spam detection, speech recognition,
etc., are some important applications of supervised machine learning.

2.Unsupervised Machine Learning


Unsupervised machine learning is just the opposite of supervised learning.
Unlike supervised machine learning, it does not need supervision, which means
it does not require labelled datasets to train machines. Hence, in unsupervised
machine learning, the output is predicted without any supervision. The main aim
of the unsupervised learning algorithm is to group or categorise the unsorted
dataset according to the similarities, patterns, and differences. Network analysis,
recommendation system, anomaly detection, singular value decompositions,
etc., are some important applications of unsupervised machine learning.

3.Reinforcement Learning
Reinforcement learning is defined as the feedback-based
method to learn from past experience and improve the
performance of models. In this method, an AI agent
automatically explores its surrounding by hitting and trial
actions.

3.Neural Network:
neural networks that develop the structure of a human brain. Similar to the human
brain that has neurons interconnected to one another, artificial neural networks also
have neurons that are interconnected to one another in various layers of the
networks. These neurons are known as nodes.

4.Deep learning: Deep learning is another subset of machine


learning that uses layers of neural networks rather than a single neural
network. The word “deep” in deep learning is referring to these layers.
You can think of each neural-network-layer as a space where something
new is learned from a set of data.
To put this in plain terms, picture five vertical lines, like so: I I I I I. The
first one is the input layer — that’s where the deep learning software
receives data. The second line, layer two, runs the data through an
algorithm to learn something about that data. The third layer does the
same thing using a different algorithm, which allows the software to
learn a second thing about the data. The fourth layer does the same
thing, with yet another algorithm, so that the deep learning software
now has three things it’s learned about the initial input. In the fifth and
final layer, the software outputs what it has learned.

Other Branches of Artificial Intelligence:


Other major subfields of AI includes:

1. Robotics
Robotics is an interdisciplinary branch of computer science and
engineering. Robotics involves design, construction, operation, and use
of robots. The goal of robotics is to design machines that can help and
assist humans.
Robotics integrates fields of mechanical engineering, electrical
engineering, information engineering, mechatronics, electronics,
bioengineering, computer engineering, control engineering, software
engineering, mathematics, etc.
Robotics develops machines that can substitute for humans and
replicate human actions. Robots can be used in many situations for
many purposes, but today many are used in dangerous environments
(including inspection of radioactive materials, bomb detection and
deactivation), manufacturing processes, or where humans cannot
survive (e.g. in space, underwater, in high heat, and clean up and
containment of hazardous materials and radiation).
Robots can take any form, but some are made to resemble humans in
appearance. This is claimed to help in the acceptance of robots in
certain replicative behaviours which are usually performed by people.
Such robots attempt to replicate walking, lifting, speech, cognition, or
any other human activity. Many of today’s robots are inspired by nature,
contributing to the field of bio-inspired robotics.
Certain robots require user input to operate while other robots function
autonomously. The concept of creating robots that can operate
autonomously dates back to classical times, but research into the
functionality and potential uses of robots did not grow substantially until
the 20th century.
Throughout history, it has been frequently assumed by various scholars,
inventors, engineers, and technicians that robots will one day be able to
mimic human behaviour and manage tasks in a human-like fashion.
Today, robotics is a rapidly growing field, as technological advances
continue; researching, designing, and building new robots serve various
practical purposes, whether domestically, commercially, or militarily.
Many robots are built to do jobs that are hazardous to people, such as
defusing bombs, finding survivors in unstable ruins, and exploring mines
and shipwrecks. Robotics is also used in STEM (science, technology,
engineering, and mathematics) as a teaching aid.

2. Expert Systems
An expert system is a computer program that is designed to solve
complex problems and to provide decision-making ability like a human
expert. It performs this by extracting knowledge from its knowledge base
using the reasoning and inference rules according to the user queries.
The expert system is a part of AI, and the first ES was developed in the
year 1970, which was the first successful approach of artificial
intelligence. It solves the most complex issue as an expert by extracting
the knowledge stored in its knowledge base.
The system helps in decision making for compsex problems using both
facts and heuristics like a human expert. It is called so because it
contains the expert knowledge of a specific domain and can solve any
complex problem of that particular domain. These systems are designed
for a specific domain, such as medicine, science, etc.
The performance of an expert system is based on the expert’s
knowledge stored in its knowledge base. The more knowledge stored in
the KB, the more that system improves its performance. One of the
common examples of an ES is a suggestion of spelling errors while
typing in the Google search box.

3. Fuzzy Logic
Fuzzy logic is a form of many-valued logic in which the truth value of
variables may be any real number between 0 and 1. It is employed to
handle the concept of partial truth, where the truth value may range
between completely true and completely false. By contrast, in Boolean
logic, the truth values of variables may only be the integer values 0 or 1.
The term fuzzy logic was introduced with the 1965 proposal of fuzzy set
theory by Iranian Azerbaijani mathematician Lotfi Zadeh. Fuzzy logic
had, however, been studied since the 1920s, as infinite-valued
logic—notably by Łukasiewicz and Tarski.
Fuzzy logic is based on the observation that people make decisions
based on imprecise and non-numerical information. Fuzzy models or
sets are mathematical means of representing vagueness and imprecise
information (hence the term fuzzy).
These models have the capability of recognising, representing,
manipulating, interpreting, and using data and information that are vague
and lack certainty. Fuzzy logic has been applied to many fields, from
control theory to artificial intelligence.
In the boolean system truth value, 1.0 represents the absolute truth
value and 0.0 represents the absolute false value. But in the fuzzy
system, there is no logic for the absolute truth and absolute false value.
But in fuzzy logic, there is an intermediate value too present which is
partially true and partially false.

Applications of Artificial Intelligence:


1.AI in Healthcare
● Healthcare Industries are applying AI to make a better and faster diagnosis
than humans. AI can help doctors with diagnoses and can inform when
patients are worsening so that medical help can reach to the patient before
hospitalisation.

2.AI in Gaming
● AI can be used for gaming purpose. The AI machines can play strategic
games like chess, where the machine needs to think of a large number of
possible places.

3. AI in Finance
● AI and finance industries are the best matches for each other. The finance
industry is implementing automation, chatbot, adaptive intelligence, algorithm
trading, and machine learning into financial processes.

4. AI in Data Security
● The security of data is crucial for every company and cyber-attacks are
growing very rapidly in the digital world. AI can be used to make your data
more safe and secure. Some examples such as AEG bot, AI2 Platform,are
used to determine software bug and cyber-attacks in a better way.

5. AI in Social Media
● Social Media sites such as Facebook, Twitter, and Snapchat contain billions of
user profiles, which need to be stored and managed in a very efficient way. AI
can organize and manage massive amounts of data. AI can analyze lots of
data to identify the latest trends, hashtag, and requirement of different users.

6. AI in Travel & Transport


● AI is becoming highly demanding for travel industries. AI is capable of doing
various travel related works such as from making travel arrangement to
suggesting the hotels, flights, and best routes to the customers. Travel
industries are using AI-powered chatbots which can make human-like
interaction with customers for better and fast response.

7. AI in Robotics:
● Artificial Intelligence has a remarkable role in Robotics. Usually, general
robots are programmed such that they can perform some repetitive task, but
with the help of AI, we can create intelligent robots which can perform tasks
with their own experiences without pre-programmed.
● Humanoid Robots are best examples for AI in robotics, recently the intelligent
Humanoid robot named as Erica and Sophia has been developed which can
talk and behave like humans.
8. AI in Entertainment
● We are currently using some AI based applications in our daily life with some
entertainment services such as Netflix or Amazon. With the help of ML/AI
algorithms, these services show the recommendations for programs or shows.

9. AI in Agriculture
● Agriculture is an area which requires various resources, labor, money, and
time for best result. Now a day's agriculture is becoming digital, and AI is
emerging in this field. Agriculture is applying AI as agriculture robotics, solid
and crop monitoring, predictive analysis. AI in agriculture can be very helpful
for farmers.

10. AI in education:
● AI can automate grading so that the tutor can have more time to teach. AI
chatbot can communicate with students as a teaching assistant.
● AI in the future can be work as a personal virtual tutor for students, which will
be accessible easily at any time and any place.

What is knowledge?
A knowledge base in artificial intelligence aims to capture human expert
knowledge to support decision-making, problem-solving, and more.

What is knowledge representation?

Humans are best at understanding, reasoning, and interpreting


knowledge. Human knows things,which is knowledge and as per their
knowledge they perform various actions in the real world. But how
machines do all these things comes under knowledge representation
and reasoning. Hence we can describe Knowledge representation as
following:

1. Knowledge representation and reasoning (KR, KRR) is the part of


Artificial intelligence which concerned with AI agents' thinking and
how thinking contributes to intelligent behaviour of agents.
2. It is responsible for representing information about the real world
so that a computer can understand and can utilise this knowledge to
solve the complex real world problems such as diagnosis a medical
condition or communicating with humans in natural language.

3.It is also a way which describes how we can represent knowledge in


artificial Intelligence. Knowledge representation is not just
storing data into some database, but it also enables an
intelligent machine to learn from that knowledge and
experiences so that it can behave intelligently like a human.

Knowledge representation

1. Propositional logic
2. Semantic network

3.first order logic

4. Rule based system

5. Frames

1.Propositional logic (PL) : it is the simplest form of logic where all the
statements are made by propositions. A proposition is a declarative statement
which is either true or false. It is a technique of knowledge representation in logical
and mathematical form.

Example:
1. a) It is Sunday.
2. b) The Sun rises from West (False proposition)
3. c) 3+3= 7(False proposition)
4. d) 5 is a prime number.

Following are some basic facts about propositional logic:


● Propositional logic is also called Boolean logic as it works on 0 and 1.
● A proposition formula which is always true is called tautology, and it is also
called a valid sentence.
● A proposition formula which is always false is called Contradiction.
● Statements which are questions, commands, or opinions are not propositions
such as "Where is Rohini", "How are you", "What is your name", are not
propositions.

Logical Connectives:
Logical connectives are used to connect two simpler propositions or representing a
sentence logically. We can create compound propositions with the help of logical
connectives. There are mainly five connectives, which are given as follows:

1. Negation: A sentence such as ¬ P is called negation of P. A literal can be

either Positive literal or negative literal.


2. Conjunction: A sentence which has ∧ connective such as, P ∧ Q is called a

conjunction.
Example: Rohan is intelligent and hardworking. It can be written as,
P= Rohan is intelligent,
Q= Rohan is hardworking. → P∧ Q.
3. Disjunction: A sentence which has ∨ connective, such as P ∨ Q. is called

disjunction, where P and Q are the propositions.


Example: "Ritika is a doctor or Engineer",
Here P= Ritika is Doctor. Q= Ritika is Doctor, so we can write it as P ∨ Q.
4. Implication: A sentence such as P → Q, is called an implication. Implications

are also known as if-then rules. It can be represented as


If it is raining, then the street is wet.
Let P= It is raining, and Q= Street is wet, so it is represented as P → Q
5. Biconditional: A sentence such as P⇔ Q is a Biconditional sentence,

example If I am breathing, then I am alive


P= I am breathing, Q= I am alive, it can be represented as P ⇔ Q.
2.Semantic network :A semantic network is a knowledge structure that depicts
how concepts are related to one another and illustrates how they interconnect.

EXAMPLE

· Tom is an instance of dog.

· Tom caught a cat

· Tom is owned by rashan.

· Tom is brown in colour.

· Dogs like bones.

· The dog sat on the mat.

· A dog is a mammal.

· A cat is an instance animal

· All mammals are animals.


· Mammals have fur.

3.first order logic :

1.First-order logic is another way of knowledge representation in


artificial intelligence. It is an extension to propositional logic.

2.First-order logic is also known as Predicate logic or First-order


predicate logic. First-order logic is a powerful language that
develops information about the objects in a more easy way and can
also express the relationship between those objects.

Basic Elements of First-order logic:

Constant 1, 2, A, John, Mumbai, cat,....

Variables x, y, z, a, b,....

Predicates Brother, Father, >,....

Function sqrt, LeftLegOf, ....

Connectives ∧, ∨, ¬, ⇒, ⇔
Equality ==

Quantifier ∀, ∃

Quantifiers in First-order logic:

● A quantifier is a language element which generates quantification, and


quantification specifies the quantity of specimen in the universe of discourse.

There are two types of quantifier:

a. Universal Quantifier, (for all, everyone, everything)

b. Existential quantifier, (for some, at least one).

1.Universal Quantifier:

Universal quantifier is a symbol of logical representation, which specifies that the

statement within its range is true for everything or every instance of a particular

thing.

The Universal quantifier is represented by a symbol ∀, which resembles an inverted

A.

If x is a variable, then ∀x is read as:

● For all x
● For each x

● For every x.

Example:

1.All man drink coffee.

∀x man(x) → drink (x, coffee).

2.Existential Quantifier:
Existential quantifiers are the type of quantifiers, which express that the statement

within its scope is true for at least one instance of something.

It is denoted by the logical operator ∃, which resembles as inverted E. When it is

used with a predicate variable then it is called as an existential quantifier.

If x is a variable, then existential quantifier will be ∃x or ∃(x). And it will be read

as:

● There exists a 'x.'

● For some 'x.'

● For at least one 'x.'

Example:

Some boys are intelligent.

∃x: boys(x) ∧ intelligent(x)


4.rule-based system:
A rule-based system is a system that applies human-made rules to store,
sort and manipulate data. In doing so, it mimics human intelligence. To
work, rule-based systems require a set of facts or source of data, and a
set of rules for manipulating that data. These rules are sometimes
referred to as ‘If statements’ as they tend to follow the line of ‘IF X
happens THEN do Y’.

4.Frames: frames are record like structure that have slots and
slot values for an entity.

Example:

Employee details

Ram(

(profession (value manger))

(EmpID (value 100213))

(Address (value Delhi))

Types of knowledge
Following are the various types of knowledge:
1. Declarative Knowledge:

● Declarative knowledge is to know about something.


● It includes concepts, facts, and objects.

Procedural Knowledge

● It is also known as imperative knowledge.


● Procedural knowledge is a type of knowledge which is responsible for
knowing how to do something.
● It includes rules, strategies, procedures.

Meta-knowledge:

● Knowledge about the other types of knowledge is called Meta-knowledge.

Heuristic knowledge:

● Heuristic knowledge is rules of thumb based on previous experiences,


awareness of approaches, and which are good to work but not guaranteed.

5. Structural knowledge:

● Structural knowledge is basic knowledge to problem-solving.


● It describes relationships between various concepts such as kind of, part of,
and grouping of something.

AI knowledge cycle:
An Artificial intelligence system has the following components for displaying
intelligent behavior:

● Perception
● Learning
● Knowledge Representation and Reasoning
● Planning
● Execution

The above diagram is showing how an AI system can interact with the real world and
what components help it to show intelligence. AI system has Perception component
by which it retrieves information from its environment. It can be visual, audio or
another form of sensory input. The learning component is responsible for learning
from data captured by Perception comportment. In the complete cycle, the main
components are knowledge representation and Reasoning. These two components
are involved in showing the intelligence in machine-like humans. These two
components are independent with each other but also coupled together. The
planning and execution depend on analysis of Knowledge representation and
reasoning.

What is a knowledge-based system?


The knowledge-based agent (KBA) take input from the
environment by perceiving the environment. The input is taken by
the inference engine of the agent and which also communicate
with KB to decide as per the knowledge store in KB. The learning
element of KBA regularly updates the KB by learning new
knowledge.

○ Knowledge-based agents are those agents who have the capability of


maintaining an internal state of knowledge, reason over that knowledge,
update their knowledge after observations and take actions. These agents
can represent the world with some formal representation and act
intelligently.

○ Knowledge-based agents are composed of two main parts:

○ Knowledge-base and

○ Inference system.

A knowledge-based agent must able to do the following:

○ An agent should be able to represent states, actions, etc.

○ An agent Should be able to incorporate new percepts

○ An agent can update the internal representation of the world

○ An agent can deduce the internal representation of the world

○ An agent can deduce appropriate actions.

The architecture of knowledge-based agent:


The above diagram is representing a generalized architecture for a knowledge-based
agent. The knowledge-based agent (KBA) take input from the environment by
perceiving the environment. The input is taken by the inference engine of the agent
and which also communicate with KB to decide as per the knowledge store in KB.
The learning element of KBA regularly updates the KB by learning new knowledge.

Knowledge-based systems typically have three components, which


include:

● Knowledge base: A knowledge base is an established


collection of information and resources. The system uses this
as its repository for the knowledge it uses to make decisions.
● Interface engine: An interface engine processes data
throughout the system. It acts similarly to a search engine
within the system by locating relevant information based on
the requests.
● User interface: The user interface is how the
knowledge-based system appears to users on the computer.
This allows users to interact with the system and submit
requests.
What is a knowledge-base:
Knowledge-base is a central component of a knowledge-based agent, it is also
known as KB. It is a collection of sentences (here 'sentence' is a technical
term and it is not identical to sentence in English). These sentences are
expressed in a language which is called a knowledge representation language.
The Knowledge-base of KBA stores fact about the world.

Why use a knowledge base?

Knowledge-base is required for updating knowledge for an agent to learn with


experiences and take action as per the knowledge.

The fundamental characteristics of an AI-powered knowledge


base include:
● Accurate and relevant content. AI extracts insights and patterns from
large sets of data and then makes predictions based on that information. It
then provides users with real-time and pertinent information that
addresses their needs.
● A consistent voice. All agents have access to the same relevant content,
which means they’re all working with the same information and
providing a consistent customer experience.
● Faster service. An AI-powered knowledge base significantly speeds
business activities, with customers enjoying faster service from agents.
● Simplification. Robust doesn’t have to mean complex. Easy-to-navigate
dashboards and interfaces make it easy to create and maintain even the
most intricate knowledge base.
● Improved collaboration: are at their best when customers and agents
work together. AI gathers feedback and recommendations from agents,
customers, and community users to continuously update and improve
content.

Key Benefits of Knowledge Base In Artificial


Intelligence
Knowledge management systems boost productivity, minimize risk, and
increase your competitive advantage. A knowledge base in AI delivers many
important benefits, including:

1. Simplifying knowledge discovery. Until a few years ago, organizations


only had access to two knowledge management practices: capturing and
sharing knowledge. Today’s systems add discovering and maintaining
knowledge to the mix. Knowledge workers can now use multiple tools,
including cloud-based solutions, to share their knowledge and expertise
with others. AI makes the entire process easier with new technologies like
semantic search, natural language processing, and machine learning.
2. Connecting data from disparate sources. People working in different
departments don’t necessarily capture and share information in the same
way. For instance, sales reps may use a CRM tool, and support teams use
a ticketing system. AI helps organizations connect and combine
knowledge across multiple processes.
3. Keeping your knowledge base content up-to-date. Over time, a
tremendous amount of information ends up stored in a knowledge base.
Eventually, some of it becomes outdated, but no one bothers to update or
dispose of it. AI supports knowledge maintenance by reminding
employees to update knowledge regularly.
4. Providing important knowledge management metrics. It’s challenging
to prove a knowledge management system is fulfilling its promise. AI
makes it far easier to track performance metrics like first call resolution,
average wait time, and average call abandonment rate.

Where knowledge-based systems are used


Over the years, knowledge-based systems have been developed for a number of
applications. MYCIN, for example, was an early knowledge-based system
created to help doctors diagnose diseases. Healthcare has remained an important
market for knowledge-based systems, which are now referred to as clinical
decision-support systems in the health sciences context.

What is Grammar?
Grammar is defined as the rules for forming well-structured sentences.
While describing the syntactic structure of well-formed programs, Grammar
plays a very essential and important role. In simple words, Grammar denotes
syntactical rules that are used for conversation in natural languages.
For Example, in the ‘C’ programming language, the precise grammar rules
state how functions are made with the help of lists and statements.
Mathematically, a grammar G can be written as a 4-tuple (N, T, S, P) where,
N or VN = set of non-terminal symbols, or variables.
T or ∑ = set of terminal symbols.
S = Start symbol where S ∈ N
P = Production rules for Terminals as well as Non-terminals.
It has the form α → β, where α and β are strings on VN ∪ ∑ and at least one
symbol of α belongs to VN
Different Types of Grammar in NLP:
● Context-Free Grammar (CFG)
● Constituency Grammar (CG)
● Dependency Grammar (DG)

1. Context-Free Grammar (CFG)

A context-free grammar, which is in short represented as CFG, is a notation used for


describing the languages and it is a superset of Regular grammar which you can see from
the following diagram:

Image Source: Google Images


CFG consists of a finite set of grammar rules having the following four components

● Set of Non-Terminals
● Set of Terminals
● Set of Productions
● Start Symbol
Set of Non-terminals
It is represented by V. The non-terminals are syntactic variables that denote the sets of
strings, which helps in defining the language that is generated with the help of grammar.

Set of Terminals
It is also known as tokens and represented by Σ. Strings are formed with the help of the
basic symbols of terminals.

Set of Productions
It is represented by P. The set gives an idea about how the terminals and nonterminals can
be combined. Every production consists of the following components:

● Non-terminals,
● Arrow,
● Terminals (the sequence of terminals).
The left side of production is called non-terminals while the right side of production is
called terminals.

Start Symbol
The production begins from the start symbol. It is represented by symbol S. Non-terminal
symbols are always designated as start symbols.

2.Constituency Grammar (CG)

It is also known as Phrase structure grammar. It is called constituency Grammar as it is


based on the constituency relation. It is the opposite of dependency grammar.

Before deep dive into the discussion of CG, let’s see some fundamental points about
constituency grammar and constituency relation.

● All the related frameworks view the sentence structure in terms of constituency
relation.
● To derive the constituency relation, we take the help of subject-predicate division
of Latin as well as Greek grammar.
● Here we study the clause structure in terms of noun phrase NP and verb phrase VP.
For Example,
Sentence: This tree is illustrating the constituency relation
Image Source: Google Images

Now, Let’s deep dive into the discussion on Constituency Grammar:

In Constituency Grammar, the constituents can be any word, group of words, or phrases
and the goal of constituency grammar is to organize any sentence into its constituents
using their properties. To derive these properties we generally take the help of:

● Part of speech tagging,


● A noun or Verb phrase identification, etc
For Example, constituency grammar can organize any sentence into its three constituents-
a subject, a context, and an object.
Sentence: <subject> <context> <object>
These three constituents can take different values and as a result, they can generate
different sentences. For Example, If we have the following constituents, then
<subject> The horses / The dogs / They
<context> are running / are barking / are eating
<object> in the park / happily / since the morning
Example sentences that we can be generated with the help of the above constituents are:
“The dogs are barking in the park”
“They are eating happily”
“The horses are running since the morning”
Now, let’s look at another view of constituency grammar is to define their grammar in
terms of their part of speech tags.

Say a grammar structure containing a


[determiner, noun] [ adjective, verb] [preposition, determiner, noun]
which corresponds to the same sentence – “The dogs are barking in the park”
Another view (Using Part of Speech)
< DT NN > < JJ VB > < PRP DT NN > -------------> The dogs are barking in the park

3.Dependency Grammar (DG)


It is opposite to the constituency grammar and is based on the dependency relation.
Dependency grammar (DG) is opposite to constituency grammar because it lacks phrasal
nodes.

Before deep dive into the discussion of DG, let’s see some fundamental points about
Dependency grammar and Dependency relation.

● In Dependency Grammar, the words are connected to each other by directed links.
● The verb is considered the center of the clause structure.
● Every other syntactic unit is connected to the verb in terms of directed link. These
syntactic units are called dependencies.
For Example,
Sentence: This tree is illustrating the dependency relation

Image Source: Google Images

Now, Let’s deep dive into the discussion of Dependency Grammar:

1. Dependency Grammar states that words of a sentence are dependent upon other
words of the sentence.

For Example, in the previous sentence which we discussed in CG, “barking dog”
was mentioned and the dog was modified with the help of barking as the
dependency adjective modifier exists between the two.

2. It organizes the words of a sentence according to their dependencies. One of the


words in a sentence behaves as a root and all the other words except that word
itself are linked directly or indirectly with the root using their dependencies. These
dependencies represent relationships among the words in a sentence and
dependency grammars are used to infer the structure and semantic dependencies
between the words.

For Example, Consider the following sentence:


Sentence: Analytics Vidhya is the largest community of data scientists and provides the best
resources for understanding data and analytics.

Parser
Parser is a compiler that is used to break the data into smaller elements coming
from lexical analysis phase.

A parser takes input in the form of sequence of tokens and produces output in the
form of parse tree.

Parsing is of two types: top down parsing and bottom up parsing.

Top down paring


● The top down parsing is known as recursive parsing or predictive parsing.

● Bottom up parsing is used to construct a parse tree for an input string.

● In the top down parsing, the parsing starts from the start symbol and
transform it into the input symbol.

Parse Tree representation of input string "acdb" is as follows:

Bottom up parsing

● Bottom up parsing is also known as shift-reduce parsing.

● Bottom up parsing is used to construct a parse tree for an input string.

● In the bottom up parsing, the parsing starts with the input symbol and
construct the parse tree up to the start symbol by tracing out the rightmost
derivations of string in reverse.

Example
Production

1. E → T
2. T → T * F
3. T → id
4. F → T
5. F → id

Parse Tree representation of input string "id * id" is as follows:

UNIT III:
What is an Expert System?
An expert system is a computer program that is designed to solve complex
problems and to provide decision-making ability like a human expert. It performs
this by extracting knowledge from its knowledge base using the reasoning and
inference rules according to the user queries.

The expert system is a part of AI, and the first ES was developed in the year 1970,
which was the first successful approach of artificial intelligence. It solves the most
complex issue as an expert by extracting the knowledge stored in its knowledge
base. The system helps in decision making for complex problems using both facts
and heuristics like a human expert. It is called so because it contains the expert
knowledge of a specific domain and can solve any complex problem of that
particular domain. These systems are designed for a specific domain, such as
medicine, science, etc.

/Expertarchitecture is internally structure that represents to the


knowledge base has the certain domain knowledge that is
implemented by an expert to server conclusion from facts./

Components of Expert System

An expert system mainly consists of three components:

● User Interface
● Inference Engine

● Knowledge Base

1. User Interface

With the help of a user interface, the expert system interacts with the
user, takes queries as an input in a readable format, and passes it to
the inference engine. After getting the response from the inference
engine, it displays the output to the user. In other words, it is an
interface that helps a non-expert user to communicate with the expert
system to find a solution.

2. Inference Engine(Rules of Engine)

● The inference engine is known as the brain of the expert system as it is


the main processing unit of the system. It applies inference rules to the
knowledge base to derive a conclusion or deduce new information. It
helps in deriving an error-free solution of queries asked by the user.

● With the help of an inference engine, the system extracts the


knowledge from the knowledge base.

● There are two types of inference engine:

● Deterministic Inference engine: The conclusions drawn from this type


of inference engine are assumed to be true. It is based on facts and
rules.

● Probabilistic Inference engine: This type of inference engine contains


uncertainty in conclusions, and based on the probability.

3. Knowledge Base
● The knowledgebase is a type of storage that stores knowledge
acquired from the different experts of the particular domain. It is
considered as big storage of knowledge. The more the knowledge
base, the more precise will be the Expert System.

● It is similar to a database that contains information and rules of a


particular domain or subject.

● One can also view the knowledge base as collections of objects and
their attributes. Such as a Lion is an object and its attributes are it is a
mammal, it is not a domestic animal, etc.

Expert System Architecture Diagram:


Explain Structure of Expert System:

Knowledge Acquisitions: It is the process of extracting, organizing, and


structuring the domain knowledge, specifying the rules to acquire the knowledge
from various experts, and storing that knowledge into the knowledge base.

1. Knowledge Base – It is a warehouse of special heuristics or rules, which are


used directly by knowledge, facts (productions). It has knowledge that is needed
for understanding, formulating, & problem solving.There are two types of
knowledge base i.e. Static and Dynamic.

2 Working Memory – It helps to describe the current running problem and


record intermediate output. Records Intermediate Hypothesis & Decisions: 1.
Plan, 2. Agenda, 3. Solution
3. Inference Engine – It is heart of expert system as well as helps to manage the
entire structure of the expert system, and it delivers a different methodology for
reasoning.
4. Explanation System – It helps to trace responsibility and justify the
behaviour of an expert system by firing questions and answers, such as Why,
How, What, Where, When, Who.
5. User Interface – It allows users to insert their queries using their own Natural
Language Processing otherwise menus & graphics.
6. Knowledge Engineer – Main objective of this engineer is to design a system for
specific problem domain with the use of an expert system shell.
7.System Engineer – To design user interface and declarative format of
knowledge base as well as to build inference engine
8. Users – They are non expert people who want to seek direct advice.
9.Case-History-A case history basically refers to a file containing relevant information
pertaining to an individual client or group.

Expert System Shell

Expert system shell contains the special software development environment, and

it has basic components of expert systems such as – Knowledge-based


management system, Workplace, Explanation facility, Reasoning capacity,

Inference engine, user interface. This shell is linked along with a predefined

method for designing different applications through configuring of those

components.

Example for Shell:


· CLIPS (C Language Integrated Production System)
· OPS5, ART, JESS, and Eclipse

There are three primary participants in the building of Expert System:

1. Expert: The success of an ES much depends on the knowledge

provided by human experts. These experts are those persons who are
specialized in that specific domain.

2. Knowledge Engineer: Knowledge engineer is the person who gathers

the knowledge from the domain experts and then codifies that
knowledge to the system according to the formalism.

3. End-User: This is a particular person or a group of people who may

not be experts, and working on the expert system needs the solution or
advice for his queries, which are complex.

Capabilities of the Expert System

● Advising: It is capable of advising the human being for the query of any
domain from the particular ES.
● Provide decision-making capabilities: It provides the capability of
decision making in any domain, such as for making any financial
decision, decisions in medical science, etc.

● Problem-solving: It has problem-solving capabilities.

● Explaining a problem: It is also capable of providing a detailed


description of an input problem.

● Interpreting the input: It is capable of interpreting the input given by the


user.

● Predicting results: It can be used for the prediction of a result.

● Diagnosis: An ES designed for the medical field is capable of


diagnosing a disease without using multiple components as it already
contains various inbuilt medical tools.

Advantages of Expert System

● These systems are highly reproducible.

● They can be used for risky places where the human presence is not
safe.

● Error possibilities are less if the KB contains correct knowledge.

Limitations of Expert System

● The response of the expert system may get wrong if the knowledge
base contains the wrong information.

● Its maintenance and development costs are very high.

● Knowledge acquisition for designing is much difficult.

● It cannot learn from itself and hence requires manual updates.


What is a rule-based system ?
● A rule-based system is a system that applies human-made rules to

store, sort and manipulate data. In doing so, it mimics human


intelligence.

● Rule-based systems require a set of facts or source of data, and a

set of rules for manipulating that data. These rules are sometimes
referred to as ‘If statements’ as they tend to follow the line of ‘IF X
happens THEN do Y’.

RULE BASED ARCHITECTURE OF AN EXPERT


SYSTEM
The most common form of architecture used in expert and other types of knowledge based
systems is the production system or it is called rule based systems. This type of system uses
knowledge encoded in the form of production rules i.e. if-then rules. The rule has a
conditional part on the left hand side and a conclusion or action part on the right hand side.
For example if: condition1 and condition2 and condition3
Each rule represents a small chunk of knowledge to the given domain of expertise. When the
known facts support the conditions in the rule’s left side, the conclusion or action part of the
rule is then accepted as known. The rule based architecture of an expert system consists of
the domain expert, knowledge engineer, inference engine, working memory, knowledge base,
external interfaces, user interface, explanation module, database spreadsheets executable
programs s mentioned in figure.
What are the main components of a
rules-based system?
A typical rule-based system has seven basic components:

The knowledge base


It holds the domain knowledge that is necessary for problem solving. In a
rules-based system, knowledge gets represented as a set of rules. Every rule
specifies a relation, recommendation, directive, strategy or heuristic and has
the IF (condition) THEN (action) structure.
Components of Knowledge Base

● Factual Knowledge: The knowledge which is based on facts and


accepted by knowledge engineers comes under factual knowledge.

● Heuristic Knowledge: This knowledge is based on practice, the ability

to guess, evaluation, and experiences.

Knowledge Representation: It is used to formalize the knowledge stored in


the knowledge base using the If-else rules.

The database

The database has a set of facts that are used to compare against the IF
(condition) part of the rules that are held in the knowledge base.

The inference engine


The inference engine is used to perform the reasoning through which the
expert system comes to a solution. The job of the inference engine is to link
the rules that are defined in the knowledge base with the facts that are stored
in the database. The inference engine is also known as the semantic reasoner.
It infers information or performs required actions on the basis of input and the
rule base that's present in the knowledge base.

Explanation facilities/Modules

The explanation facilities make it possible for the user to ask the expert
system how a specific conclusion was reached and why a specific fact is
required.
The explanation module explains the reasoning of the system to a user. It provides the
user with an explanation of the reasoning process when requested. The credibility of
expert system will be established only when it is able to explain “how and why” a
particular conclusion is drawn. This explanation increases the belief of user in the expert
system.
a) Explanation(How): To respond to a how query, the explanation module traces
the chain of rules fired during a consolation with the user. This explanation mode
can be activated once the process is over. It explains how a fact was deduced by
the system and similarly how a rule was/wasn’t used. The simplest way to specify
this is to explain the rule which allows the deduction. For e.g.
If the system (S) will give information about the parent-child relationship to the user (U)
then the followings can be possible.

S: My diagnosis is “A is the father of B”


U: How?
S: The result was obtained by the addition of following facts and rules.
Fact no 11: A is the parent of Hari.
Fact no 15: A is a male.
Fact no 110: X is father of
X is parent of Y, X is male.
So A is the father of B.

b) Explanation (Why)? To respond to a why query, the explanation module must be


able to explain why certain information is needed by the inference engine to
complete a step in the reasoning process. This mode of explanation is dynamic and
is used when the system functions in backward chaining. If the user doesn’t
understand the reason behind the question. The system is capable of

explaining why the question was asked. For example S: Is the following true?

A is the father of B.
U:Why?
S:I need the fact:
A is the father of B to establish the following fact “B is the son of
A”.
By using the rule no. 4:
A is the father of B:
B is the son of A.

User interface

The user interface is the means through which the user seeking a solution to a
problem communicates with the expert system. The communication should
be as meaningful and friendly as possible and the user interface should be as
intuitive as possible.

Working memory

The working memory stores temporary information and data.

advantages
1. A rule-based system is generally accurate in terms of its results.
2. The outputs generated by the system are dependent on rules so the
output responses are stable and not random.
3. The coverage for different circumstances is less, whatever scenarios
are covered by the Rule Based system will provide high accuracy.
The error rate goes down because of the predefined rules.

Disadvantages
1. A rule-based system is built upon a lot of data, deep knowledge of
the domain, and a lot of manual work.
2. Writing and generating rules for a complex system is quite
challenging and time-consuming.
3. The self-learning capacity in a rule-based system is less as it
generates the result as per the rules.

KNOWLEDGE ACQUISITION:
Knowledge acquisition is the gathering or collecting knowledge from
various sources. It is the process of adding new knowledge to a
knowledge base and refining or improving knowledge that was
previously acquired. Acquisition is the process of expanding the
capabilities of a system or improving its performance at some specified
task. So it is the goal oriented creation and refinement of knowledge.
Acquired knowledge may consist of facts, rules, concepts, procedures,
heuristics, formulas, relationships, statistics or any other useful
information. Source of these knowledge may be experts in the domain of
interest, text books, technical papers, database reports, journals and the
environments. Knowledge acquisition is a continuous process and is
spread over an entire lifetime. Example of knowledge acquisition is
machine learning. It may be a process of autonomous knowledge creation
or refinements through the use of computer programs.The role of
knowledge engineer is also very important with respect to developing the
refinements of knowledge. Knowledge engineers may be the
professionals who elicit knowledge from experts. They integrate
knowledge from various sources like creates and edits code, operates the
various interactive tools, build the knowledge base etc.
Knowledge Acquisition Techniques

Many techniques have been developed to deduce knowledge from an expert.


They are termed as knowledge acquisition techniques. They are:

a) Diagram Based Techniques

b) Matrix Based Techniques

c) Hierarchy-Generation Techniques

d) Protocol Analysis Techniques


e) Protocol Generation Techniques

f) Sorting Techniques
● In diagram based techniques the generation and use of concept
maps, event diagrams and process maps. This technique captures
the features like “why, when, who, how and where”.
● The matrix based techniques involve the construction of grids
indicating such things as problems encountered against possible
solutions.
● Hierarchical techniques are used to build hierarchical structures
like trees.
● Protocol analysis technique is used to identify the type of
knowledge like goals, decisions, relationships etc.
● The protocol generation techniques include various types of
interviews like structured, semi-structured and unstructured.

UNIT IV
What is learning?
Machine learning is a subset of AI, which enables the machine to
automatically learn from data, improve performance from past
experiences, and make predictions. Machine learning contains a set of
algorithms that work on a huge amount of data.
Role of learning
Machine learning is a subset of AI, which enables the machine to automatically
learn from data, improve performance from past experiences, and make
predictions. Machine learning contains a set of algorithms that work on a huge
amount of data.

Some important applications in which machine learning is widely used are given
below:
1. Healthcare: Machine Learning is widely used in the healthcare industry. It

helps healthcare researchers to analyze data points and suggest outcomes.


Natural language processing helped to give accurate insights for better
results of patients.

2. Banking and Finance: In the banking and finance sector, machine learning
helped in many ways, such as fraud detection, portfolio management, risk
management, chatbots, document analysis, high-frequency trading,
mortgage underwriting, AML detection, anomaly detection, risk credit score
detection, KYC processing, etc. Hence, machine learning is widely applied in
the banking and finance sector to reduce error as well as time.

3. Image Recognition: It is one of the most common applications of machine

learning which is used to detect the image over the internet. Further, various
social media sites such as Facebook uses image recognition for tagging the
images to your Facebook friends with its feature named auto friend tagging
suggestion.
Further, now a day's, almost all mobile devices come with exciting face
detection features. Using this feature, you can secure your mobile data with
face unlocking, so if anyone tries to access your mobile device, they cannot
open without face recognition.

4. Speech Recognition: It enables users to search content without writing

text or, in other words, 'search by voice'. It can search content/products on


YouTube, Google, Amazon, etc. platforms by your voice. This technology is
referred to as speech recognition.Some important examples of speech
recognitions are Google assistant, Siri, Cortana, Alexa, etc.

5. Self-driving cars: This is one of the most exciting applications of machine

learning. Machine learning plays a vital role in the manufacturing of


self-driving cars. It uses an unsupervised learning method to train car
models to detect people and objects while driving.
Types of Machine Learning:

These ML algorithms help to solve different business problems like Regression,


Classification, Forecasting, Clustering, and Associations, etc.

Based on the methods and way of learning, machine learning is divided into mainly
four types, which are:

1. Supervised Machine Learning

2. Unsupervised Machine Learning

3. Reinforcement Learning

1. Supervised Machine Learning

As its name suggests, Supervised machine learning is based on supervision. It


means in the supervised learning technique, we train the machines using the
"labelled" dataset, and based on the training, the machine predicts the output.

Let's understand supervised learning with an example. Suppose we have an


input dataset of cats and dog images. So, first, we will provide the training to
the machine to understand the images, such as the shape & size of the tail of
cat and dog, Shape of eyes, colour, height (dogs are taller, cats are smaller),
etc. After completion of training, we input the picture of a cat and ask the
machine to identify the object and predict the output. Now, the machine is well
trained, so it will check all the features of the object, such as height, shape,
colour, eyes, ears, tail, etc., and find that it's a cat. So, it will put it in the Cat
category. This is the process of how the machine identifies the objects in
Supervised Learning.

Categories of Supervised Machine Learning

Supervised machine learning can be classified into two types of problems, which are
given below:

● Classification

● Regression

a) Classification

Classification algorithms are used to solve the classification problems in which the
output variable is categorical, such as "Yes" or No, Male or Female, Red or Blue, etc.
The classification algorithms predict the categories present in the dataset.

b) Regression

Regression algorithms are used to solve regression problems in which there is a


linear relationship between input and output variables. These are used to predict
continuous output variables, such as market trends, weather prediction, etc.

Advantages and Disadvantages of Supervised Learning

Advantages:

● Since supervised learning work with the labelled dataset so we can have an
exact idea about the classes of objects.

● These algorithms are helpful in predicting the output on the basis of prior
experience.
Disadvantages:

● These algorithms are not able to solve complex tasks.

● It may predict the wrong output if the test data is different from the training
data.

● It requires lots of computational time to train the algorithm.

2. Unsupervised Machine Learning

Unsupervised learning is different from the Supervised learning technique; as its


name suggests, there is no need for supervision. It means, in unsupervised machine
learning, the machine is trained using the unlabeled dataset, and the machine
predicts the output without any supervision.

The main aim of the unsupervised learning algorithm is to group or categories the
unsorted dataset according to the similarities, patterns, and differences. Machines
are instructed to find the hidden patterns from the input dataset.

Let's take an example to understand it more preciously; suppose there is a basket of


fruit images, and we input it into the machine learning model. The images are totally
unknown to the model, and the task of the machine is to find the patterns and
categories of the objects.

Categories of Unsupervised Machine Learning

Unsupervised Learning can be further classified into two types, which are given
below:

● Clustering

● Association

1) Clustering
The clustering technique is used when we want to find the inherent groups from the
data. It is a way to group the objects into a cluster such that the objects with the
most similarities remain in one group and have fewer or no similarities with the
objects of other groups. An example of the clustering algorithm is grouping the
customers by their purchasing behaviour.

2) Association

Association rule learning is an unsupervised learning technique, which finds


interesting relations among variables within a large dataset. The main aim of this
learning algorithm is to find the dependency of one data item on another data item
and map those variables accordingly so that it can generate maximum profit.

Advantages and Disadvantages of Unsupervised Learning


Algorithm

Advantages:

● These algorithms can be used for complicated tasks compared to the


supervised ones because these algorithms work on the unlabeled dataset.

● Unsupervised algorithms are preferable for various tasks as getting the


unlabeled dataset is easier as compared to the labelled dataset.

Disadvantages:

● The output of an unsupervised algorithm can be less accurate as the dataset


is not labelled, and algorithms are not trained with the exact output in prior.

● Working with Unsupervised learning is more difficult as it works with the


unlabelled dataset that does not map with the output.

3.Reinforcement Learning
● Reinforcement learning works on a feedback-based process, in which an AI
agent (A software component) automatically explore its surrounding by
hitting & trail, taking action, learning from experiences, and improving its
performance.

● The reinforcement learning process is similar to a human being; for example,


a child learns various things by experiences in his day-to-day life. An example
of reinforcement learning is to play a game, where the Game is the
environment, moves of an agent at each step define states, and the goal of
the agent is to get a high score. Agent receives feedback in terms of
punishment and rewards.

Advantages and Disadvantages of Reinforcement Learning

Advantages

● It helps in solving complex real-world problems which are difficult to be solved


by general techniques.

● The learning model of RL is similar to the learning of human beings; hence


most accurate results can be found.

● Helps in achieving long term results.

Disadvantage

● RL algorithms are not preferred for simple problems.

● RL algorithms require huge data and computations.

● Too much reinforcement learning can lead to an overload of states which can
weaken the results.

Performance Measures in machine learning:


Being Humans we want to know the efficiency or the performance of any
machine or software we come across. For example, if we consider a car we
want to know the Mileage, or if we there is a certain algorithm we want to
know about the Time and Space Complexity, similarly there must be some or
the other way we can measure the efficiency or performance of our Machine
Learning Models as well.

As Regression gives us continuous values as output and Classification gives us


discrete values as output, we will focus on Classification Metrics.

1.ACCURACY

The most commonly and widely used metric, for any model, is accuracy, it basically
does what It says, calculates what is the prediction accuracy of our model. The
formulation is given below:

As we can see, it basically tells us among all the points how many of them are
correctly predicted.

Advantages:

​ 1. Easy to use Metric.


​ 2. Highly Interpretable.
​ 3. If data points are balanced it gives proper effectiveness of the model.

Disadvantages:
​ 1. Not recommended for Imbalanced data, as results can be misleading.
Let me give you an example. Let’s say we have 100 data points among
which 95 points are negative and 5 points are positive. If I have a dumb
model, which only predicts negative results then at the end of training I
will have a model that will only predict negative. But still, be 95% accurate
based on the above formula. Hence not recommended for imbalanced
data.
​ 2. We don’t understand where our model is making mistakes.

2.CONFUSION METRICS

As the name suggests it is a 2×2 matrix that has Actual and Predicted as Rows and
Columns respectively. It determines the number of Correct and Incorrect
Predictions, we didn’t bother about incorrect prediction in the Accuracy method,
and we only consider the correct ones, so the Confusion Matrix helps us
understand both aspects.

Let’s have a look at the diagram to have a better understanding of it:

WHAT DOES THESE NOTATION MEANS?

Imagine I have a binary classification problem with classes as positive and negative
labels, now, If my actual point is Positive and my Model predicted point is also
positive then I get a True Positive, here “True” means correctly classified and
“Positive” is the predicted class by the model, Similarly If I have actual class as
Negative and I predicted it as Positive, i.e. an incorrect predicted, then I get False
Positive, “False” means Incorrect prediction, and “Positive” is the predicted class
by the model.

Advantages:

​ 1. It specifies a model is confused between which class labels.


​ 2. You get the types of errors made by the model, especially Type I or
Type II.
​ 3. Better than accuracy as it shows the incorrect predictions as well, you
understand in-depth the errors made by the model, and rectify the areas
where it is going incorrect.

Disadvantage:

​ 1. Not very much well suited for Multi-class.

3.PRECISION & RECALL:

Precision is the measure which states, among all the predicted positive class, how
many are actually positive, formula is given below:

Recall is the measure which states, among all the Positive classes how many are
actually predicted correctly, formula is given below:

Recall is the measure which states, among all the Positive classes how many
are actually predicted correctly, formula is given below:
We often seek for getting high precision and recall. If both are high means our
model is sensible. Here, we also take into consideration, the incorrect points,
hence we are aware where our model is making mistakes, and Minority class is
also taken into consideration.

Advantages:

​ 1. It tells us about the efficiency of the model


​ 2. Also shows us how much or data is biased towards one class.
​ 3. Helps us understand whether our model is performing well in an
imbalanced dataset for the minority class.

Disadvantages:

​ 1. Recall deals with true positives and false negatives and precision
deals with true positives and false positives. It doesn’t deal with all
the cells of the confusion matrix. True negatives are never taken into
account.
​ 2. Hence, precision and recall should only be used in situations,
where the correct identification of the negative class does not play a
role.
​ 3. Focuses only on Positive class.
​ 4. Best suited for Binary Classification.

4.F1-SCORE:
​ F1 score is the harmonic mean of the precision and recall, where an F1 score
reaches its best value at 1 (perfect precision and recall). The F1 score is also
known as the Sorensen–Dice coefficient or Dice similarity coefficient (DSC).
​ It leverages both the advantages of Precision and Recall. An Ideal model will
have precision and recall as 1 hence F1 score will also be 1.

​ Applications of Natural Language Processing

​ 1. Chatbots

​ Chatbots are a form of artificial intelligence that are programmed to

interact with humans in such a way that they sound like humans

themselves. Depending on the complexity of the chatbots, they can

either just respond to specific keywords or they can even hold full

conversations that make it tough to distinguish them from humans.

Chatbots are created using Natural Language Processing and

Machine Learning, which means that they understand the

complexities of the English language and find the actual meaning of

the sentence and they also learn from their conversations with

humans and become better with time. Chatbots work in two simple

steps. First, they identify the meaning of the question asked and

collect all the data from the user that may be required to answer the

question. Then they answer the question appropriately.

​ 2. Autocomplete in Search Engines


​ Have you noticed that search engines tend to guess what you are

typing and automatically complete your sentences? For example, On

typing “game” in Google, you may get further suggestions for “game

of thrones”, “game of life” or if you are interested in maths then

“game theory”. All these suggestions are provided using

autocomplete that uses Natural Language Processing to guess what

you want to ask. Search engines use their enormous data sets to

analyze what their customers are probably typing when they enter

particular words and suggest the most common possibilities. They

use Natural Language Processing to make sense of these words and

how they are interconnected to form different sentences.

​ 3. Voice Assistants

​ These days voice assistants are all the rage! Whether its Siri, Alexa,

or Google Assistant, almost everyone uses one of these to make

calls, place reminders, schedule meetings, set alarms, surf the

internet, etc. These voice assistants have made life much easier. But

how do they work? They use a complex combination of speech

recognition, natural language understanding, and natural language

processing to understand what humans are saying and then act on

it. The long term goal of voice assistants is to become a bridge

between humans and the internet and provide all manner of services

based on just voice interaction. However, they are still a little far

from that goal seeing as Siri still can’t understand what you are

saying sometimes!

​ 4. Language Translator
​ Want to translate a text from English to Hindi but don’t know Hindi?

Well, Google Translate is the tool for you! While it’s not exactly

100% accurate, it is still a great tool to convert text from one

language to another. Google Translate and other translation tools as

well as use Sequence to sequence modelling that is a technique in

Natural Language Processing. It allows the algorithm to convert a

sequence of words from one language to another which is

translation. Earlier, language translators used Statistical machine

translation (SMT) which meant they analysed millions of documents

that were already translated from one language to another (English

to Hindi in this case) and then looked for the common patterns and

basic vocabulary of the language. However, this method was not

that accurate as compared to Sequence to sequence modelling.

​ 5. Sentiment Analysis

​ Almost all the world is on social media these days! And companies

can use sentiment analysis to understand how a particular type of

user feels about a particular topic, product, etc. They can use natural

language processing, computational linguistics, text analysis, etc. to

understand the general sentiment of the users for their products

and services and find out if the sentiment is good, bad, or neutral.

Companies can use sentiment analysis in a lot of ways such as to

find out the emotions of their target audience, to understand

product reviews, to gauge their brand sentiment, etc. And not just

private companies, even governments use sentiment analysis to find


popular opinion and also catch out any threats to the security of the

nation.

​ 6. Grammar Checkers

​ Grammar and spelling is a very important factor while writing

professional reports for your superiors, even assignments for your

lecturers. After all, having major errors may get you fired or failed!

That’s why grammar and spell checkers are a very important tool for

any professional writer. They can not only correct grammar and

check spellings but also suggest better synonyms and improve the

overall readability of your content. And guess what, they utilise

natural language processing to provide the best possible piece of

writing! The NLP algorithm is trained on millions of sentences to

understand the correct format. That is why it can suggest the

correct verb tense, a better synonym, or a clearer sentence structure

than what you have written. Some of the most popular grammar

checkers that use NLP include Grammarly, WhiteSmoke,

ProWritingAid, etc.

​ 7. Email Classification and Filtering

​ Emails are still the most important method for professional

communication. However, all of us still get thousands of

promotional Emails that we don’t want to read. Thankfully, our

emails are automatically divided into 3 sections namely, Primary,

Social, and Promotions which means we never have to open the

Promotional section! But how does this work? Email services use
natural language processing to identify the contents of each Email

with text classification so that it can be put in the correct section.

​ Computer Vision:

Computer vision is a subfield of artificial intelligence that deals with acquiring,


processing, analyzing, and making sense of visual data such as digital images
and videos. It is one of the most compelling types of artificial intelligence that
we regularly implement in our daily routines.

How does Computer Vision Work?


Computer vision is a technique that extracts information from visual data, such as
images and videos. Although computer vision works similarly to human eyes with
brain work, this is probably one of the biggest open questions for IT professionals:
How does the human brain operate and solve visual object recognition?
On a certain level, computer vision is all about pattern recognition which includes
the training process of machine systems for understanding the visual data such as
images and videos, etc.

Firstly, a vast amount of visual labeled data is provided to machines to train it. This
labeled data enables the machine to analyze different patterns in all the data points
and can relate to those labels. E.g., suppose we provide visual data of millions of
dog images. In that case, the computer learns from this data, analyzes each photo,
shape, the distance between each shape, color, etc., and hence identifies patterns
similar to dogs and generates a model. As a result, this computer vision model can
now accurately detect whether the image contains a dog or not for each input
image.

Applications of computer vision


Computer vision is one of the most advanced innovations of artificial intelligence
and machine learning. As per the increasing demand for AI and Machine Learning
technologies, computer vision has also become a centre of attraction among
different sectors. It greatly impacts different industries, including retail, security,
healthcare, automotive, agriculture, etc.

Below are some most popular applications of computer vision:

○ Facial recognition: Computer vision has enabled machines to detect face


images of people to verify their identity. Initially, the machines are given
input data images in which computer vision algorithms detect facial features
and compare them with databases of fake profiles. Popular social media
platforms like Facebook also use facial recognition to detect and tag users.
Further, various government spy agencies are employing this feature to
identify criminals in video feeds.

○ Healthcare and Medicine: Computer vision has played an important role in


the healthcare and medicine industry. Traditional approaches for evaluating
cancerous tumors are time-consuming and have less accurate predictions,
whereas computer vision technology provides faster and more accurate
chemotherapy response assessments; doctors can identify cancer patients
who need faster surgery with life-saving precision.

○ Self-driving vehicles: Computer vision technology has also contributed to


its role in self-driving vehicles to make sense of their surroundings by
capturing video from different angles around the car and then introducing it
into the software. This helps to detect other cars and objects, read traffic
signals, pedestrian paths, etc., and safely drive its passengers to their
destination.

○ Optical character recognition (OCR)


Optical character recognition helps us extract printed or handwritten text
from visual data such as images. Further, it also enables us to extract text
from documents like invoices, bills, articles, etc.

○ Machine inspection: Computer vision is vital in providing an image-based


automatic inspection. It detects a machine's defects, features, and functional
flaws, determines inspection goals, chooses lighting and material-handling
techniques, and other irregularities in manufactured products.

○ Retail (e.g., automated checkouts): Computer vision is also being


implemented in the retail industries to track products, shelves, wages, record
product movements into the store, etc. This AI-based computer vision
technique automatically charges the customer for the marked products upon
checkout from the retail stores.

○ 3D model building: 3D model building or 3D modeling is a technique to


generate a 3D digital representation of any object or surface using the
software. In this field also, computer vision plays its role in constructing 3D
computer models from existing objects. Furthermore, 3D modeling has a
variety of applications in various places, such as Robotics, Autonomous
driving, 3D tracking, 3D scene reconstruction, and AR/VR.
○ Medical imaging: Computer vision helps medical professionals make better
decisions regarding treating patients by developing visualization of specific
body parts such as organs and tissues. It helps them get more accurate
diagnoses and a better patient care system. E.g., Computed Tomography
(CT) or Magnetic Resonance Imaging (MRI) scanner to diagnose pathologies
or guide medical interventions such as surgical planning or for research
purposes.

○ Automotive safety: Computer vision has added an important safety feature


in automotive industries. E.g., if a vehicle is taught to detect objects and
dangers, it could prevent an accident and save thousands of lives and
property.

○ Surveillance: It is one of computer vision technology's most important and


beneficial use cases. Nowadays, CCTV cameras are almost fitted in every
place, such as streets, roads, highways, shops, stores, etc., to spot various
doubtful or criminal activities. It helps provide live footage of public places
to identify suspicious behavior, identify dangerous objects, and prevent
crimes by maintaining law and order.

○ Fingerprint recognition and biometrics: Computer vision technology


detects fingerprints and biometrics to validate a user's identity. Biometrics
deals with recognizing persons based on physiological characteristics, such
as the face, fingerprint, vascular pattern, or iris, and behavioral traits, such
as gait or speech. It combines Computer Vision with knowledge of human
physiology and behavior.

What is a robot?

A robot is a machine that looks like a human, and is capable of performing out of box
actions and replicating certain human movements automatically by means of
commands given to it using programming. Examples: Drug Compounding Robot,
Automotive Industry Robots, Order Picking Robots, Industrial Floor Scrubbers and
Sage Automation Gantry Robots, etc.

Components of Robot

Several components construct a robot, these components are as follows:

○ Actuators: Actuators are the devices that are responsible for moving and
controlling a system or machine. It helps to achieve physical movements by
converting energy like electrical, hydraulic and air, etc. Actuators can create
linear as well as rotary motion.

○ Power Supply: It is an electrical device that supplies electrical power to an


electrical load. The primary function of the power supply is to convert
electrical current to power the load.

○ Electric Motors: These are the devices that convert electrical energy into
mechanical energy and are required for the rotational motion of the
machines.

○ Pneumatic Air Muscles: Air Muscles are soft pneumatic devices that are
ideally best fitted for robotics. They can contract and extend and operate by
pressurised air filling a pneumatic bladder. Whenever air is introduced, it can
contract up to 40%.

○ Muscles wire: These are made up of nickel-titanium alloy called Nitinol and
are very thin in shape. It can also extend and contract when a specific
amount of heat and electric current is supplied into it. Also, it can be formed
and bent into different shapes when it is in its martensitic form. They can
contract by 5% when electrical current passes through them.

○ Piezo Motors and Ultrasonic Motors: Piezoelectric motors or Piezo motors


are the electrical devices that receive an electric signal and apply a
directional force to an opposing ceramic plate. It helps a robot to move in the
desired direction. These are the best suited electrical motors for industrial
robots.

○ Sensor: Sensors are the devices or machines which help to detect the events
or changes in the environment and send data to the computer processor.
These devices are usually equipped with other electronic devices. Similar to
human organs, the electrical sensor also plays a crucial role in Artificial
Intelligence & robotics. AI algorithms control robots by sensing the
environment, and it provides real-time information to computer processors.

Applications of Robotics

Robotics have different application areas. Some of the important applications


domains of robotics are as follows:

Robotics in defence sectors: The defence sector is undoubtedly the one of


the main parts of any country. Each country wants their defence system to
be strong. Robots help to approach inaccessible and dangerous zone during
war. DRDO has developed a robot named Daksh to destroy life-threatening
objects safely. They help soldiers to remain safe and deployed by the military
in combat scenarios.
Robotics in Medical sectors: Robots also help in various medical fields such
as laparoscopy, neurosurgery, orthopaedic surgery, disinfecting rooms,
dispensing medication, and various other medical domains.

Robotics in Industrial Sector: Robots are used in various industrial


manufacturing industries such as cutting, welding, assembly, disassembly,
pick and place for printed circuit boards, packaging & labelling, palletizing,
product inspection & testing, colour coating, drilling, polishing and handling
the materials.
The industrial robot has some important advantages, which are as follows:

○ Accuracy

○ Flexibility

○ Reduced labour charge

○ Low noise operation

○ Fewer production damages

○ Increased productivity rate.

Robotics in Entertainment: Over the last decade, use of robots is


continuously getting increased in entertainment areas. Robots are being
employed in the entertainment sector, such as movies, animation, games
and cartoons. Robots are very helpful where repetitive actions are required.

Robots in the mining industry: Robotics is very helpful for various mining
applications such as robotic dozing, excavation and haulage, robotic
mapping & surveying, robotic drilling and explosive .handling, etc. A mining
robot can solely navigate flooded passages and use cameras and other
sensors to detect valuable minerals. Further, robots also help in excavation
to detect gases and other materials and keep humans safe from harm and
injuries.
Javatpoint Services

You might also like