0% found this document useful (0 votes)
46 views

Unit I Introduction To Artificial Intelligence

The document discusses the introduction to artificial intelligence including the need for AI, applications of AI, and logic and heuristic search techniques. It then provides definitions of artificial intelligence and machine learning. It describes how AI works using machine learning algorithms and training data. It distinguishes between AI, machine learning, and deep learning. It discusses the importance of AI and provides examples of uses in various fields like medicine, transportation, banking, entertainment and others. It also discusses how AI achieves unprecedented accuracy and is reliable and quick.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views

Unit I Introduction To Artificial Intelligence

The document discusses the introduction to artificial intelligence including the need for AI, applications of AI, and logic and heuristic search techniques. It then provides definitions of artificial intelligence and machine learning. It describes how AI works using machine learning algorithms and training data. It distinguishes between AI, machine learning, and deep learning. It discusses the importance of AI and provides examples of uses in various fields like medicine, transportation, banking, entertainment and others. It also discusses how AI achieves unprecedented accuracy and is reliable and quick.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

Unit I Introduction to Artificial Intelligence (07 Hours)

Need of AI, Applications of AI, Logic programming-solving problems using logic


programming, Heuristic search techniques- constraint satisfaction problems, local search
techniques, greedy search

Artificial intelligence (AI)

What is artificial intelligence (AI)?

When machines mimic humans intelligence and can make their own decisions, think, and
learn, then they are said to be artificially intelligent.

Machines are programmed about what to think. But in the case of machine learning,
machines are made to analyze, read data, observe and learn from their mistakes.

Artificial Intelligence is probably the most complex of creation of humanity. This is


disregarding the fact that the field itself is largely unexplored.

It has already left its mark on several Industries like manufacturing, retail, finance,
healthcare, e-commerce industries where businesses think they have fully utilized the
potential that AI carries. But in reality, is it still the tip of the iceberg.

The huge amount of data that we generate every day digitally has further helped with the
rapid growth of artificial intelligence. Making the machine faster and more efficient for
businesses and consumers alike. These intelligent machines not only try to mimic human-like
thinking but over time learns to do new operations as well.

Artificial intelligence is the simulation of human intelligence processes by machines,


especially computer systems. Specific applications of AI include expert systems, natural
language processing, speech recognition and machine vision.

How does AI work?

As the hype around AI has accelerated, vendors have been scrambling to promote how their
products and services use it. Often, what they refer to as AI is simply a component of the
technology, such as machine learning. AI requires a foundation of specialized hardware and
software for writing and training machine learning algorithms. No single programming
language is synonymous with AI, but Python, R, Java, C++ and Julia have features popular
with AI developers.

In general, AI systems work by ingesting large amounts of labeled training data, analyzing
the data for correlations and patterns, and using these patterns to make predictions about
future states. In this way, a chatbot that is fed examples of text can learn to generate lifelike
exchanges with people, or an image recognition tool can learn to identify and describe objects
in images by reviewing millions of examples. New, rapidly improving generative AI
techniques can create realistic text, images, music and other media.
AI programming focuses on cognitive skills that include the following:

 Learning. This aspect of AI programming focuses on acquiring data and creating


rules for how to turn it into actionable information. The rules, which are called
algorithms, provide computing devices with step-by-step instructions for how to
complete a specific task.
 Reasoning. This aspect of AI programming focuses on choosing the right algorithm
to reach a desired outcome.
 Self-correction. This aspect of AI programming is designed to continually fine-tune
algorithms and ensure they provide the most accurate results possible.
 Creativity. This aspect of AI uses neural networks, rules-based systems, statistical
methods and other AI techniques to generate new images, new text, new music and
new ideas.

Differences between AI, machine learning and deep learning

AI, machine learning and deep learning are common terms in enterprise IT and sometimes
used interchangeably, especially by companies in their marketing materials. But there are
distinctions. The term AI, coined in the 1950s, refers to the simulation of human intelligence
by machines. It covers an ever-changing set of capabilities as new technologies are
developed. Technologies that come under the umbrella of AI include machine learning and
deep learning.

Machine learning enables software applications to become more accurate at predicting


outcomes without being explicitly programmed to do so. Machine learning algorithms use
historical data as input to predict new output values. This approach became vastly more
effective with the rise of large data sets to train on. Deep learning, a subset of machine
learning, is based on our understanding of how the brain is structured. Deep learning's use of
artificial neural network structure is the underpinning of recent advances in AI, including
self-driving cars and ChatGPT.

Importance of artificial intelligence

Below we are going to read about the huge importance of Artificial Intelligence:

 Artificial Intelligence's importance and subsequent components have been known for
a long time. They are being seen as tools and techniques to make this world better.
And it's not like you have to go through to be able to use these fancy tech gadgets.
You can look around, and I'm sure most of your work is smoothed out by artificial
intelligence.
 Its importance lies in making our life easier. These technologies are a great asset to
humans and are programmed to minimize human effort as much as possible. They can
operate in an automated fashion. Therefore, manual intervention is the last thing that
can be sought or seen during the operation of parts involving this technology.
 These machines speed up your tasks and processes with guaranteed accuracy and
precision, making them a useful and valuable tool. Apart from making the world an
error-free place with their simple and everyday techniques, these technologies and
applications are not only related to our ordinary and everyday life. It is affecting and
holds importance for other domains as well.
Top 4 Uses of Artificial Intelligence

Important uses of Artificial Intelligence are given below:

1. In Medical Science

 Artificial Intelligence has made an unprecedented impact in the medical industry and
hence changed the face of the medical industry. Various machine learning algorithms
and models have efficiently predicted various important use cases, such as
determining whether a particular patient has malignant or benign cancer or tumor
based on symptoms, health records, and history. It is also being used in future
predictions where patients are well informed about their deteriorating health and what
they should do to return to a normal and healthy life.
 Artificial intelligence has created a virtual care private assistant specifically built for
people's needs. It is widely used to monitor, research different types of cases, and
analyze past cases and their outcomes. It also seeks to improve their model's and
assistants' efficiency by predicting what could be improved and making themselves
smarter.
 The use of healthcare bots is another efficient move taken by the medical industry to
work their way up in medicine, which is known to provide 24/7 assistance and take up
the less important work of managing appointments. It has not have been possible
without the intervention of these smart artificial intelligence-based machines.

2. In the Field of Air Transport

 One of the major systematic transport in the world is air transport, and there has
become an urgent need to optimize their mode of operation. Here came the
involvement of Artificial Intelligence, where the machine is involved in planning the
routes along with the flight landing and take-off charts.
 Artificial intelligence has been used in many aircraft, navigation maps, taxing routes,
and a quick examination of the entire cockpit panel to ensure the correct operation of
each component. Hence, it gives very promising results and is being adopted very
frequently. The ultimate aim of artificial intelligence in air transport is to give easier
and more comfortable travel to human beings.

3. In the field of banking and financial institutions

 Artificial Intelligence plays a vital role in managing financial transactions and


handling many other activities in the bank. The day-to-day operations of banks, such
as transactions and financial operations, stock market money and their management,
etc., are being handled more easily and efficiently by these machine learning models.
 Use cases such as anti-money laundering where suspicious financial transactions are
being monitored and reported to regulators are a classic example of artificial
intelligence in the banking and financial industry. Other use cases include credit
systems analysis which is popular among credit card companies. Suspicious credit
card transactions are tracked geographically and acted upon and resolved based on
various parameters.

4. In the field of gaming and entertainment


 From virtual reality games to today's modern games, this is one industry where
artificial intelligence has made the biggest leap forward. Bots are always there for you
to play with, so you don't need another person to play.
 The level of personalized detail and graphics is also possible due to the advent of
Artificial Intelligence and is taking this industry to a different level.

5. AI Achieves Unprecedented Accuracy

 AI achieves remarkable accuracy through deep neural networks, which was


previously impossible.
 For example, Google Search and your interactions with Alexa are all deep learning-
based, becoming more accurate the more we use them. AI techniques are also used in
medical fields to search for cancer cells on MRI with high precision as highly trained
radiologists.

6. AI Is Reliable & Quick

AI performs computer-generated tasks consistently, extensively, and reliably. However,


human skills are required to set up the system and ask the appropriate questions.

7. AI Adds Intelligence to Products

 AI will not be sold as an individual product. Instead, your products will be enhanced
with AI integration, like the Apple products discussed with the Siri feature.
 Chatbots, automation, and smart devices, combined with massive amounts of data,
can improve many technologies at home and in the workplace.

8. AI Evaluates Deep Data

 With big data and computing power, it has become possible to develop fraud
detection systems that were nearly impossible just a few years ago.
 It would help if you had a lot of data to train deep learning models because they learn
directly from the data. The more data, the more accurate they are.

9. AI Fully Utilized Data

It would help if you implemented AI to get answers from the data. The role of data is more
important than ever; Its gives you an edge over your competitors if you have the best data
system in this competitive industry because the best data will win!

AI with Python – Logic Programming

In this chapter, we will focus logic programming and how it helps in Artificial Intelligence.

We already know that logic is the study of principles of correct reasoning or in simple words
it is the study of what comes after what. For example, if two statements are true then we can
infer any third statement from it.
Concept

Logic Programming is the combination of two words, logic and programming. Logic
Programming is a programming paradigm in which the problems are expressed as facts and
rules by program statements but within a system of formal logic. Just like other programming
paradigms like object oriented, functional, declarative, and procedural, etc., it is also a
particular way to approach programming.

How to Solve Problems with Logic Programming

Logic Programming uses facts and rules for solving the problem. That is why they are called
the building blocks of Logic Programming. A goal needs to be specified for every program in
logic programming. To understand how a problem can be solved in logic programming, we
need to know about the building blocks − Facts and Rules −

Facts

Actually, every logic program needs facts to work with so that it can achieve the given goal.
Facts basically are true statements about the program and data. For example, Delhi is the
capital of India.

Rules

Actually, rules are the constraints which allow us to make conclusions about the problem
domain. Rules basically written as logical clauses to express various facts. For example, if we
are building any game then all the rules must be defined.

Rules are very important to solve any problem in Logic Programming. Rules are basically
logical conclusion which can express the facts. Following is the syntax of rule −

A∶− B1,B2,...,Bn.

Here, A is the head and B1, B2, ... Bn is the body.

For example − ancestor(X,Y) :- father(X,Y).

ancestor(X,Z) :- father(X,Y), ancestor(Y,Z).

This can be read as, for every X and Y, if X is the father of Y and Y is an ancestor of Z, X is
the ancestor of Z. For every X and Y, X is the ancestor of Z, if X is the father of Y and Y is
an ancestor of Z.

Installing Useful Packages

For starting logic programming in Python, we need to install the following two packages −
Kanren

It provides us a way to simplify the way we made code for business logic. It lets us express
the logic in terms of rules and facts. The following command will help you install kanren −

pip install kanren


SymPy

SymPy is a Python library for symbolic mathematics. It aims to become a full-featured


computer algebra system (CAS) while keeping the code as simple as possible in order to be
comprehensible and easily extensible. The following command will help you install SymPy −

pip install sympy


Examples of Logic Programming

Followings are some examples which can be solved by logic programming −

Matching mathematical expressions

Actually we can find the unknown values by using logic programming in a very effective
way. The following Python code will help you match a mathematical expression −

Consider importing the following packages first −

from kanren import run, var, fact


from kanren.assoccomm import eq_assoccomm as eq
from kanren.assoccomm import commutative, associative

We need to define the mathematical operations which we are going to use −

add = 'add'
mul = 'mul'

Both addition and multiplication are communicative processes. Hence, we need to specify it
and this can be done as follows −

fact(commutative, mul)
fact(commutative, add)
fact(associative, mul)
fact(associative, add)

It is compulsory to define variables; this can be done as follows −

a, b = var('a'), var('b')

We need to match the expression with the original pattern. We have the following original
pattern, which is basically (5+a)*b −
Original_pattern = (mul, (add, 5, a), b)

We have the following two expressions to match with the original pattern −

exp1 = (mul, 2, (add, 3, 1))


exp2 = (add,5,(mul,8,1))

Output can be printed with the following command −

print(run(0, (a,b), eq(original_pattern, exp1)))


print(run(0, (a,b), eq(original_pattern, exp2)))

After running this code, we will get the following output −

((3,2))
()

The first output represents the values for a and b. The first expression matched the original
pattern and returned the values for a and b but the second expression did not match the
original pattern hence nothing has been returned.

Checking for Prime Numbers

With the help of logic programming, we can find the prime numbers from a list of numbers
and can also generate prime numbers. The Python code given below will find the prime
number from a list of numbers and will also generate the first 10 prime numbers.

Let us first consider importing the following packages −

from kanren import isvar, run, membero


from kanren.core import success, fail, goaleval, condeseq, eq, var
from sympy.ntheory.generate import prime, isprime
import itertools as it

Now, we will define a function called prime_check which will check the prime numbers
based on the given numbers as data.

def prime_check(x):
if isvar(x):
return condeseq([(eq,x,p)] for p in map(prime, it.count(1)))
else:
return success if isprime(x) else fail

Now, we need to declare a variable which will be used −

x = var()
print((set(run(0,x,(membero,x,(12,14,15,19,20,21,22,23,29,30,41,44,52,62,65,85)),
(prime_check,x)))))
print((run(10,x,prime_check(x))))
The output of the above code will be as follows −

{19, 23, 29, 41}


(2, 3, 5, 7, 11, 13, 17, 19, 23, 29)
Solving Puzzles

Logic programming can be used to solve many problems like 8-puzzles, Zebra puzzle,
Sudoku, N-queen, etc. Here we are taking an example of a variant of Zebra puzzle which is as
follows −

There are five houses.


The English man lives in the red house.
The Swede has a dog.
The Dane drinks tea.
The green house is immediately to the left of the white house.
They drink coffee in the green house.
The man who smokes Pall Mall has birds.
In the yellow house they smoke Dunhill.
In the middle house they drink milk.
The Norwegian lives in the first house.
The man who smokes Blend lives in the house next to the house with cats.
In a house next to the house where they have a horse, they smoke Dunhill.
The man who smokes Blue Master drinks beer.
The German smokes Prince.
The Norwegian lives next to the blue house.
They drink water in a house next to the house where they smoke Blend.

We are solving it for the question who owns zebra with the help of Python.

Let us import the necessary packages −

from kanren import *


from kanren.core import lall
import time

Now, we need to define two functions − left() and next() to check whose house is left or next
to who’s house −

def left(q, p, list):


return membero((q,p), zip(list, list[1:]))
def next(q, p, list):
return conde([left(q, p, list)], [left(p, q, list)])

Now, we will declare a variable house as follows −

houses = var()

We need to define the rules with the help of lall package as follows.
There are 5 houses −

rules_zebraproblem = lall(
(eq, (var(), var(), var(), var(), var()), houses),

(membero,('Englishman', var(), var(), var(), 'red'), houses),


(membero,('Swede', var(), var(), 'dog', var()), houses),
(membero,('Dane', var(), 'tea', var(), var()), houses),
(left,(var(), var(), var(), var(), 'green'),
(var(), var(), var(), var(), 'white'), houses),
(membero,(var(), var(), 'coffee', var(), 'green'), houses),
(membero,(var(), 'Pall Mall', var(), 'birds', var()), houses),
(membero,(var(), 'Dunhill', var(), var(), 'yellow'), houses),
(eq,(var(), var(), (var(), var(), 'milk', var(), var()), var(), var()), houses),
(eq,(('Norwegian', var(), var(), var(), var()), var(), var(), var(), var()), houses),
(next,(var(), 'Blend', var(), var(), var()),
(var(), var(), var(), 'cats', var()), houses),
(next,(var(), 'Dunhill', var(), var(), var()),
(var(), var(), var(), 'horse', var()), houses),
(membero,(var(), 'Blue Master', 'beer', var(), var()), houses),
(membero,('German', 'Prince', var(), var(), var()), houses),
(next,('Norwegian', var(), var(), var(), var()),
(var(), var(), var(), var(), 'blue'), houses),
(next,(var(), 'Blend', var(), var(), var()),
(var(), var(), 'water', var(), var()), houses),
(membero,(var(), var(), var(), 'zebra', var()), houses)
)

Now, run the solver with the preceding constraints −

solutions = run(0, houses, rules_zebraproblem)

With the help of the following code, we can extract the output from the solver −

output_zebra = [house for house in solutions[0] if 'zebra' in house][0][0]

The following code will help print the solution −

print ('\n'+ output_zebra + 'owns zebra.')

The output of the above code would be as follows −

German owns zebra.

Heuristic search techniques- constraint satisfaction problems


Heuristic search techniques and constraint satisfaction problems (CSPs) are both important
concepts in the field of artificial intelligence and problem-solving. Let's discuss each of them
briefly:

1. Heuristic Search Techniques: Heuristic search is a problem-solving approach that


uses heuristics or rules of thumb to guide the search for solutions. These techniques
are often employed when the search space is too large to explore exhaustively. Some
common heuristic search algorithms include:
o Best-First Search: Expands the most promising node based on a heuristic
evaluation function.
o A Search*: Combines the advantages of both uniform cost search and best-
first search by using a heuristic function to guide the search.
o Greedy Best-First Search: Similar to best-first search but makes decisions
solely based on the heuristic evaluation without considering the cost to reach a
node.
o Iterative Deepening A (IDA)**: An algorithm that combines depth-first
search's space-saving benefits with A*'s optimality.

These techniques are used in various AI applications such as pathfinding, game


playing, and optimization problems.

2. Constraint Satisfaction Problems (CSPs): CSPs are a class of problems where


variables are to be assigned values subject to constraints. The goal is to find a solution
that satisfies all constraints. A CSP is typically defined by:
o Variables: The objects to be assigned values.
o Domains: The set of possible values that each variable can take.
o Constraints: Restrictions on the combinations of values that the variables can
take.

CSPs are encountered in various domains including scheduling, planning,


configuration, and design. Common algorithms for solving CSPs include:

o Backtracking Search: A systematic search algorithm that explores the space


of possible assignments, backtracking when a dead-end is encountered.
o Constraint Propagation: Techniques that use the constraints to reduce the
domain of variables and simplify the problem.
o Arc Consistency Algorithms: Techniques that ensure that the values assigned
to variables are consistent with each other.

Heuristic search techniques are often combined with CSP-solving algorithms to


improve efficiency, especially in large or complex problem instances.

In summary, heuristic search techniques and constraint satisfaction problems are both
important tools in the AI toolkit for solving complex problems efficiently. They are often
used together to tackle real-world challenges across various domains.

local search techniques, greedy search


Local search techniques and greedy search are both strategies used in problem-solving and
optimization, particularly in situations where exhaustive search is impractical due to large
search spaces or computational constraints. Let's delve into each of them:

1. Local Search Techniques: Local search algorithms are iterative improvement


algorithms that start with an initial solution and iteratively move from one solution to
a neighboring solution in the search space, aiming to improve the objective function
or satisfy constraints. Unlike systematic search algorithms like breadth-first or depth-
first search, local search algorithms focus on exploring a limited portion of the search
space around the current solution. Examples of local search algorithms include:
o Hill Climbing: In hill climbing, the algorithm moves to the neighboring
solution that optimizes (or improves) the objective function the most. It
continues this process until it reaches a local optimum, where no neighboring
solution offers further improvement.
o Simulated Annealing: Simulated annealing is a probabilistic optimization
algorithm inspired by the annealing process in metallurgy. It accepts worse
solutions with a certain probability, which decreases over time, allowing the
algorithm to escape local optima and explore the search space more
effectively.
o Tabu Search: Tabu search maintains a short-term memory of recently visited
solutions (tabu list) to avoid revisiting them, preventing cycling and
encouraging exploration of new regions in the search space.
o Genetic Algorithms: Genetic algorithms use principles inspired by biological
evolution, such as mutation, crossover, and selection, to iteratively evolve a
population of solutions towards better ones.
2. Greedy Search: Greedy search is a simple, intuitive strategy that makes locally
optimal choices at each step with the hope of finding a global optimum. At each
decision point, a greedy algorithm chooses the best available option without
considering the consequences of this choice on future steps. Greedy algorithms are
often efficient and easy to implement but may not always produce optimal solutions.
Examples of greedy algorithms include:
o Dijkstra's Algorithm: Dijkstra's algorithm finds the shortest path from a
single source vertex to all other vertices in a weighted graph by greedily
selecting the vertex with the smallest tentative distance at each step.
o Prim's Algorithm: Prim's algorithm constructs a minimum spanning tree of a
connected, undirected graph by greedily selecting the edge with the smallest
weight that connects a vertex in the tree to a vertex outside the tree.
o Kruskal's Algorithm: Kruskal's algorithm also constructs a minimum
spanning tree but does so by greedily selecting edges in non-decreasing order
of weight and adding them to the tree if they do not form a cycle.

In summary, both local search techniques and greedy search are valuable approaches in
problem-solving and optimization, each with its strengths and weaknesses. They are
particularly useful in situations where exhaustive search is infeasible or impractical.
However, careful consideration must be given to the problem characteristics and algorithm
properties to ensure effective and efficient solution finding.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy