AI&MLm
AI&MLm
AI&MLm
This document is confidential and intended solely for the educational purpose of
RMK Group of Educational Institutions. If you have received this document
through email in error, please notify the system manager. This document
contains proprietary information and is intended only to the respective group /
learning community as intended. If you are not the addressee you should not
disseminate, distribute or copy through e-mail. Please notify the sender
immediately by e-mail if you have received this document by mistake and delete
this document from your system. If you are not the intended recipient you are
notified that disclosing, copying, distributing or taking any action in reliance on
the contents of this information is strictly prohibited.
22IT401
ARTIFICIAL
INTELLIGENCE AND
MACHINE LEARNING
1 CONTENTS 5
2 COURSE OBJECTIVES 6
13 ASSIGNMENT 1- UNIT 1 68
19 ASSESSMENT SCHEDULE 82
83
20 PRESCRIBED TEXT BOOKS & REFERENCE BOOKS
PRE-REQUISITE CHART
22IT401- ARTIFICIAL INTELLIGENCE
AND MACHINE LEARNING
22MA401- Probability
and Statistics
Introduction: What Is Ai, The Foundations Of Artificial Intelligence, The History Of Artificial
Intelligence, The State Of The Art. Intelligent Agents: Agents And Environments, Good Behaviour:
The Concept Of Rationality, The Nature Of Environments, And The Structure Of Agents. Solving
Problems By Searching: Problem-Solving Agents, Uninformed Search Strategies, Informed
(Heuristic) Search Strategies, Heuristic Functions. Beyond Classical Search: Local Search
Algorithms and Optimization Problems, Searching With Nondeterministic Actions And Partial
Observations, Online Search Agents And Unknown Environments. Constraint Satisfaction
Problems: Definition, Constraint Propagation, Backtracking Search, Local Search, The Structure Of
Problems.
List of Exercise/Experiments
List of Exercise/Experiments
1. Implementation of forward and backward chaining.
2. Implementation of unification algorithms.
8
4. 22IT401 ARTIFICIAL INTELLIGENCE AND MACHINE
LEARNING
LTPC
UNIT 3 LEARNING
3003
Learning from Examples: Forms of Learning, Supervised Learning, Learning Decision
Trees, Evaluating and Choosing the Best Hypothesis, The Theory of Learning, Regression
and Classification with Linear Models, Artificial Neural Networks. Applications: Human
computer interaction (HCI), Knowledge management technologies, AI for customer
relationship management, Expert systems, Data mining, text mining, and Web mining,
Other current topics.
List of Exercise/Experiments
1. Numpy Operations
2. NumPy arrays
4. NumPy Exercise:
(i) Write code to create a 4x3 matrix with values ranging from 2 to 13.
(ii) Write code to replace the odd numbers by -1 in the following array.
(iii) Perform the following operations on an array of mobile phones prices 6999,
7500, 11999, 27899, 14999, 9999.
e) Apply GST of 18% on mobile phones prices and update this array.
TOTAL : 45 PERIODS
9
4. 22IT401 ARTIFICIAL INTELLIGENCE AND MACHINE
LEARNING
LTPC
UNIT 4 FUNDAMENTALS OF MACHINE LEARNING
3003
Motivation for Machine Learning, Applications, Machine Learning, Learning associations,
Classification, Regression, The Origin of machine learning, Uses and abuses of machine
learning, Success cases, How do machines learn, Abstraction and knowledge
representation, Generalization, Factors to be considered, Assessing the success of
learning, Metrics for evaluation of classification method, Steps to apply machine learning
to data, Machine learning process, Input data and ML algorithm, Classification of machine
learning algorithms, General ML architecture, Group of algorithms, Reinforcement
learning, Supervised learning, Unsupervised learning, Semi-Supervised learning,
Algorithms, Ensemble learning, Matching data to an appropriate algorithm.
List of Exercise/Experiments
1. Build linear regression models to predict housing prices using python , using data set
available Google colabs.
2. Stock Ensemble-based Neural Network for Stock Market Prediction using Historical Stock
Data and Sentiment Analysis.
10
4. 22IT401 ARTIFICIAL INTELLIGENCE AND MACHINE
LEARNING
List of Exercise/Experiments
LTPC
Use Cases
3003
Case Study 1: Churn Analysis and Prediction (Survival Modelling)
Cox-proportional models
Churn Prediction
Imbalanced Data
Neural Network
Case study 3: Sentiment Analysis or Topic Mining from New York Times
Part-of-Speech Tagging
A/B testing
User based
Item Based
Segmentation Strategies
Lifetime Value
Risk Profiling
Portfolio Optimization
Graph Construction
11
Route Optimization
5.COURSE OUTCOME
Cognitive/
Affective Expected
Course
Course Outcome Statement Level of the Level of
Code
Course Attainment
Outcome
Course Outcome Statements in Cognitive Domain
12
6.CO-PO/PSO MAPPING
C211 K
3 2 1 1 3 2 3
.5 3
C211 2.8 2 1.2 1.2 3 0.8 3
13
UNIT II
KNOWLEDGE
REPRESENTATION AND
REASONING
14
LECTURE PLAN – UNIT II
UNIT I INTRODUCTION
Sl.
No
NO PROPOSED ACTUAL
OF LECTURE LECTURE PERTAINING TAXONOMY MODE OF
TOPIC
PERI CO(s) LEVEL DELIVERY
ODS
PERIOD PERIOD
1 PROPOSITION LOGIC
1 27.01.24 CO2 K2 MD1
-
FIRST ORDER
1 29.01.24 CO2 K2 MD1
2 PREDICATE LOGIC
INFERENCE,
FORWARD CHAINING
3 1 30.01.24 CO2 K2 MD1
-BACKWARD
CHAINING
RESOLUTION,
1 01.02.24 CO2 K3 MD1
4 UNIFICATION
PLANNING:
DEFINITION,
5 ALGORITHMS,
PLANNING GRAPHS, 1 02.02.24 CO2 K3 MD1
HIERARCHICAL
PLANNING, MULTI-
AGENT PLANNING
KNOWLEDGE
6 REPRESENTATION -
ONTOLOGICAL
2 03.02.24 CO2 K2 MD1
ENGINEERING -
CATEGORIES AND
OBJECTS
EVENTS - MENTAL
EVENTS AND
7 MENTAL OBJECTS -
1 06.02.24 CO2 K2 MD1
REASONING
SYSTEMS FOR
CATEGORIES
REASONING WITH
DEFAULT 1 08.02.24 CO2 K2 MD1
8 INFORMATION
LECTURE PLAN – UNIT II
16
ACTIVITY BASED LEARNING – UNIT II
17
Lecture Notes
Proportional logic
Definition: A proposition is a statement that can be either
true or false; it must be one or the other, and it cannot be both
A proposition formula which has both true and false values is called
Atomic Propositions
Compound propositions
Example:
Example:
• First-order logic (like natural language) does not only assume that the world
contains facts like propositional logic but also assumes the following things
in the world:
• Syntax
• Semantics
Syntax of First-Order logic:
The syntax of FOL determines which collection of symbols is a logical
expression in first-order logic. The basic syntactic elements of first-
order logic are symbols. We write statements in short-hand notation in
FOL.
Variables x, y, z, a, b,....
Connectives ∧, ∨, ¬, ⇒, ⇔
Equality ==
Quantifier ∀, ∃
Example:
It will be read as: There are all x where x is a man who drink coffee.
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 will be read as: There are some x where x is a boy who is intelligent.
1. Socrates is a Man
We can write
SOCRATESMAN
2. Plato is a man
PLATOMAN
We can write conclusion as
MAN(SOCRATES)
MAN(PLATO)
Using Predicate Logic OR FOL
1. Marcus was a man.
2. Marcus was a Pompeian.
3. All Pompeians were Romans.
4. Caesar was a ruler.
5. All Pompeians were either loyal to Caesar or hated him.
6. Every one is loyal to someone.
7. People only try to assassinate rulers they are not loyal to.
8. Marcus tried to assassinate Caesar.
1. Marcus was a man.
man(Marcus)
2. Marcus was a Pompeian.
Pompeian(Marcus)
3. All Pompeians were Romans.
x: Pompeian(x) → Roman(x)
= for all
4. Caesar was a ruler.
ruler(Caesar)
5. All Pompeians were either loyal to Caesar or hated him.
inclusive-or
x: Roman(x) → loyalto(x, Caesar) hate(x, Caesar)
exclusive-or
x: Roman(x) → (loyalto(x, Caesar) hate(x, Caesar))
(loyalto(x, Caesar) hate(x, Caesar))
6. Every one is loyal to someone.
x: y: loyalto(x, y) y: x: loyalto(x, y)
= there exists
7. People only try to assassinate rulers they are not loyal to.
x: y: person(x) ruler(y) tryassassinate(x, y)
→ loyalto(x, y)
8. Marcus tried to assassinate Caesar.
tryassassinate(Marcus, Caesar)
Is Marcus alive?
1. Marcus was a Pompeian.
Pompeian(Marcus)
KB |= KB |= false
The basic ideas
KB |= KB |= false
( ) ( ) ( )
The basic ideas
KB |= KB |= false
( ) ( ) ( )
2. Pompeian(Marcus).
4. ruler(Caesar).
→ loyalto(x, y).
8. tryassassinate(Marcus, Caesar).
Prove:
hate(Marcus, Caesar)
Question Answering
Inference rules:
Modus Ponens:
Example:
Modus Tollens:
Examples:
Hypothetical Syllogism:
Modus Ponens:
This rule states that if P and P → Q is true, then we can infer
that Q will be true
What is knowledge-engineering?
• When the IF (condition) part of the rule matches a fact, the rule is
fired and its THEN (action) part is executed.
• The inference chain indicates how an expert system applies the rules
to reach a conclusion.
Rule 1: IF Y is true
AND D is true
THEN Z is true
Rule 2: IF X is true
AND B is true
AND E is true
THEN Y is true
Rule 3: IF A is true
THEN X is true
• Forward chaining is one of the two main methods of reasoning
when using inference rules.
• Forward chaining is a popular implementation strategy for expert
systems, business and production rule and systems..
• Forward chaining starts with the available data and uses inference
rules to extract more data until a goal is reached.
• An inference engine using forward chaining searches the inference
rules until it finds one where the If clause is known to be true.
• When such a rule is found, the engine can conclude, the Then
clause, resulting in the addition of new information to its data.
• Inference engines will iterate through this process until a goal is
reached.
FORWARD CHAINING
Backward Chaining
This continues until some rule can be applied, apply to achieve goal
state.
4. Set SUBST to NIL. (At the end of this procedure, SUBST will contain
all the substitutions used to unify L1 and L2.)
(a) Call Unify with the ith argument of L1 and the ith argument of L2,
putting result in S.
6. Return SUBST.
RESOLUTION
Conversion to Clause form:
Suppose we know that all Romans who know Marcus either hate Caesar or think
that anyone who hates anyone is crazy. We could represent that in the following
After Eliminate
∀x: ¬ [Roman(x) ∧ know(x, Marcus)] V[hate(x, Caesar) V (∀y : ¬(∃z :
hate(y, z)) V thinkcrazy(x, y))]
2. Reduce the scope of each ¬ to a single term, using the fact that
¬ (¬ p) = p,
deMorgan's laws [which say that ¬ (a ∧ b) = ¬ a V ¬ b → 1
and ¬ (a V b) = ¬ a ∧ ¬ b ] → 2
and the standard correspondences between quantifiers. ∃x: Existential
quantification
[¬ ∀x: P(x) = ∃x: ¬ P(x) -> 3
and ¬ ∃x: P(x) = ∀ x: ¬P(x)] -> 4
Performing this transformation on from step 1 yields
Before:
∀x: ¬ [Roman(x) ∧ know(x, Marcus)] V[hate(x, Caesar) V (∀y : ¬(∃z : hate(y, z)) V
thinkcrazy(x, y))]
After:
∀x: [¬ Roman(x) V ¬ know(x, Marcus)] V[hate(x, Caesar) V (∀y: ∀z: ¬
hate(y, z) V thinkcrazy(x, y))]
3. Standardize variables so that each quantifier binds a unique variable. Since
variables are just dummy names, this process cannot affect the truth value of
the wff. For example, the formula
∀x: P(x) V ∀x: Q(x) would be converted to
∀x: P(x) V ∀y: Q(y)
This step is in preparation for the next.
4. Move all quantifiers to the left of the formula without changing their
relative order
Before:
∀x: [¬ Roman(x) V ¬ know(x, Marcus)] V[hate(x, Caesar) V (∀y: ∀z: ¬ hate(y, z) V
thinkcrazy(x, y))]
After:
∀x: ∀y: ∀z : [¬ Roman(x) V ¬ know(x, Marcus)] V
[hate(x, Caesar) V (¬ hale(y, z) V thinkcrazy(x, y))]
5. Eliminate existential quantifiers. ∃y : President(y)
can be transformed into the formula
President(S1)
But for above example it is not required
6. Drop the prefix
Before:
∀x: ∀y: ∀z : [¬ Roman(x) V ¬ know(x, Marcus)] V
[hate(x, Caesar) V (¬ hale(y, z) V thinkcrazy(x, y))]
After :
[¬ Roman(x) V ¬ know(x, Marcus)] V[hate(x, Caesar) V (¬ hate(y, z) V
thinkcrazy(x, y))]
7. Convert the matrix into a conjunction of disjuncts. In the case or our
example, since there are no and’s, it is only necessary to exploit the associative
property of or [ i.e., ( a ∧ b ) ∨ c ≡ ( a ∨ c ) ∧ ( b ∨ c ). and simply remove the
parentheses, giving
Before:
[¬ Roman(x) V ¬ know(x, Marcus)] V[hate(x, Caesar) V (¬ hate(y, z) V thinkcrazy(x, y))]
After:
¬ Roman(x) V ¬ know(x, Marcus) V hate(x, Caesar) V ¬ hate(y, z) V
thinkcrazy(x, y)
The Basis of Resolution
The resolution procedure is a simple iterative process.
At each step, two parent clauses, are compared (resolved), yielding
a new clause
The new clause represents ways that the two parent clauses interact
with each other
For Example:
winter V summer
¬ winter V cold
we can deduce
summer V cold
1. Eliminate →.
2. Reduce the scope of each to a single term.
3. Standardize variables so that each quantifier binds a unique variable.
4. Move all quantifiers to the left without changing their relative order.
5. Eliminate (Skolemization).
6. Drop .
7. Convert the formula into a conjunction of disjuncts.
8. Create a separate clause corresponding to each conjunct.
9. Standardize apart the variables in the set of obtained clauses.
KNOWLEDGE REPRESENTATION
❑ Ontological Engineering
❑ Events
ONTOLOGICAL ENGINEERING
• Upper ontology
• Ontological engineering has only been partially successful, and few large AI
systems are based on GP ontologies (use special purpose ontologies)
Each link indicates that the lower concept is a specialization of the upper one.
Specializations are not necessarily disjoint; a human is both an animal and an
agent, for example.
a partition?
•No! There might be dual citizenships.
Physical composition
• PartOf(Southkorea,EastAsia)
• PartOf(EastAsia,Asia)
• The PartOf predicate is transitive (and reflexive), so we can infer that
PartOf(Seoul,Asia)
• More generally:
• ∀ x PartOf(x,x)
• Two intervals Meet if the end time of the first equals the star time of the second. The
complete set of
interval relations logically below:
• Meet(i, j) ⇔ End(i) = Begin(j)
• Before(i, j) ⇔ End(i) < Begin(j)
• After(j, i) ⇔ Before(i, j)
• During(i, j) ⇔ Begin(j) < Begin(i) < End(i) < End(j)
• Overlap(i, j) ⇔ Begin(i) < Begin(j) < End(i) < End(j)
• Begins(i, j) ⇔ Begin(i) = Begin(j)
• Finishes(i, j) ⇔ End(i) = End(j)
• Equals(i, j) ⇔ Begin(i) = Begin(j) ∧ End(i) = End(j)
Graphically
Alice asks “what is the square root of 1764” and Bob replies “I don’t know.”
If Alice
insists “think harder,” Bob should realize that with some more thought, this
question can in fact be answered. On the other hand, if the question were
“Is your mother sitting down right now?” then Bob should realize that
thinking harder is unlikely to help. Knowledge about the knowledge of other
agents is also important; Bob should realize that his mother knows whether
she is sitting or not, and that asking her would be a way to find out.
Reasoning System for Categories
Semantic Networks
• Logic vs. semantic networks
• Many variations
• All represent individual objects, categories of objects and
relationships among objects.
• Cfr. OO programming.
Mammals
Subsetof
HasMother
Legs
Persons
Male
Female Subsetof Subsetof
Persons
Persons
Sisterof Legs
Mar y Lee
Reasoning System for Categories
Description logics
• Bachelor = And(Unmarried,Adult,Male)
describe the set of men with at least three sons who are all
unemployed and married to doctors, and at most two daughters who
are all professors in physics or math departments
Reasoning in Artificial Intelligence
What do you mean by the term Reasoning
Reasoning is an act of deriving a conclusion from certain premises using
a given methodology
Reasoning is a process of thinking; logically arguing; drawing inferen.
When a system is required to do something, that it has not been explicitly
told how to do, it must reason. It must figure out what it needs to know from
what it already knows.
Many types of reasoning have been identified and recognized, but many
questions regarding their logical and computational properties still remained
under controversy.
Example: Fact-1 : Robins are birds, Fact-2 : All birds have wings.
For reasoning system must find out, what it needs to know from what it
already knows.
Above three mentioned are in every human being, but the ability
level depends on education, genetics and environment.
Logical Reasoning :
Formal Logic
Informal Logic
Methods of reasoning:
Deduction
Induction
Abduction
Deductive Reasoning :
One of the basic rules of inference of deductive logic is the modus ponens
rule.
A formal English statement of this rule is : If X is true and if X being true
implies Y is true then Y is true. (X∧(X→Y)→Y
Example: All cats are felines. Bosty is a cat. I can deduce that Bosty is a
feline
Abduction Reasoning :
Abduction is a form of deductive logic which provides only a ‘plausible
inference’.
For instance:
If I read Smoking causes lung cancer and Frank died of lung cancer
, I may infer that Frank was a smoker. Again this may or may not be
true. Using statistics and probability theory , abduction may yield the most
probable inference among many possible inferences.
If this was only information available, a plausible inference would be that
John was a successful , entrepreneurial industrialist. This conclusion
could also be false since there are other roads to riches such as inheritance ,
the lottery...If we had a table of the income distribution of wealthy persons
along with their personal histories, we could refine our abduction inference
with the probability of the inference being true .
Inductive Reasoning :
A principle of reasoning to a conclusion about all members of a class from
examination of only a few members of the class; broadly, reasoning from the
particular to the general.
For example :
In 1998, The best model of Turkey is from İzmir In 1999, The best model of
Turkey is from İzmir In 2000, The best model of Turkey is from İzmir I would
logically infer that all the girls from İzmir is beautiful.
Another example :
The outcome of the inductive reasoning process will frequently contain some
measure of uncertainty because including all possible facts in the premises is
usually impossible. Deductive or inductive approaches are used in logic, rule-
based systems, and frames.
Other types of Reasoning
Analogical Reasoning
Monotonic Reasoning [Preferred in Certainty]-
Monotonic reasoning is static, in other words the truth of the
statement doesn’t change when any new information is added.
Modus Tollens
Blackboard Systems:
A blackboard system is an artificial intelligence application based
on the blackboard architectural model, where a common
knowledge base, the "blackboard", is iteratively updated by a
diverse group of specialist knowledge sources, starting with a
problem specification and ending with a solution.
66
ASSIGNMENT – UNIT II
Assignment Questions - Hard
Q. ASSIGNMENT QUESTIONS Marks Knowledge CO
No. level
1. Provide a detailed example to illustrate how 5 K4 CO3
forward chaining can solve a specific problem.
Course Outcomes:
CO2: Working knowledge on tools and frameworks.
*Allotment of Marks
10 - 5 15
PART A- UNIT-2
1. Define First order Logic?
First-order logic is another way of knowledge representation in
artificial intelligence. It is an extension to propositional logic.
FOL is sufficiently expressive to represent the natural language
statements in a concise way.
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.
The formal logic is the study of inference with purely formal content,
i.e. where content is made explicit. Eg:
Propositional logic and Predicate Logic.
Here the logical arguments are set of rules for manipulating symbols. The
rules are of two types:
Inference rules: how to obtain true formulas from other true formulas.
7. People only try to assassinate rulers they are not loyal to.
https://onlinecourses.nptel.ac.in/noc21_cs42/preview
An Introduction to Artificial Intelligence
By Prof. Mausam | IIT Delhi
https://www.coursera.org/learn/computational-thinking-problem-
solving
https://www.coursera.org/learn/artificial-intelligence-education-
for-teachers
https://www.coursera.org/specializations/ai-healthcare
https://www.coursera.org/learn/predictive-modeling-machine-
learning
https://www.drdobbs.com/parallel/the-practical-application-of-
prolog/184405220
74
VIDEO LINKS
https://onlinecourses.nptel.ac.in/noc21_cs42/preview
An Introduction to Artificial Intelligence
By Prof. Mausam | IIT Delhi
https://www.coursera.org/learn/computational-thinking-problem-
solving
https://www.coursera.org/learn/artificial-intelligence-education-
for-teachers
https://www.coursera.org/specializations/ai-healthcare
https://www.coursera.org/learn/predictive-modeling-machine-
learning
https://www.drdobbs.com/parallel/the-practical-application-of-
prolog/184405220
75
REAL TIME APPLICATION- UNIT II
76
CONTENT BEYOND SYLLABUS – UNIT I
1. BALLGAMES
Prolog is being used for fielded heavyweight applications, and benefits can
result from using the language. But Prolog is a far more interesting
language than, say, C++—and it is starting to finds its way into our homes.
The Fantasy Basketball system has been used for two years to produce the
weekly standings for the Bay Area Fantasy Basketball League of Palo Alto,
Calif. Fantasy (or Rotisserie) Basketball leagues are a growing hobby
among avid basketball fans, consisting of fictitious teams who are in the
NBA and featuring competitions between teams based on the game
statistics of their NBA players.
77
ASSESSMENT SCHEDULE
Name of the
S.NO Start Date End Date Portion
Assessment
78
PRESCRIBED TEXT BOOKS AND REFERENCE BOOKS
REFERENCES:
79
Mini Projects
Very Easy: Propositional Logic Topic:
Create a program that evaluates the truth value
of a given propositional logic expression
Disclaimer:
This document is confidential and intended solely for the educational purpose of
RMK Group of Educational Institutions. If you have received this document through
email in error, please notify the system manager. This document contains proprietary
information and is intended only to the respective group / learning community as
intended. If you are not the addressee you should not disseminate, distribute or
copy through e-mail. Please notify the sender immediately by e-mail if you have
received this document by mistake and delete this document from your system. If
you are not the intended recipient you are notified that disclosing, copying,
distributing or taking any action in reliance on the contents of this information is
strictly prohibited.
81