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

1

The document outlines a course on Artificial Intelligence (AI) led by Ms. Nida E Rub, emphasizing the importance of foundational knowledge and efficient study habits. It contrasts traditional rule-based programming with AI approaches like machine learning for tasks such as email spam detection, highlighting the adaptability and scalability of AI methods. The course covers various AI concepts, applications, and historical developments, aiming to equip students with practical skills in AI techniques.

Uploaded by

binteaqeel2004
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

1

The document outlines a course on Artificial Intelligence (AI) led by Ms. Nida E Rub, emphasizing the importance of foundational knowledge and efficient study habits. It contrasts traditional rule-based programming with AI approaches like machine learning for tasks such as email spam detection, highlighting the adaptability and scalability of AI methods. The course covers various AI concepts, applications, and historical developments, aiming to equip students with practical skills in AI techniques.

Uploaded by

binteaqeel2004
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 33

ARTIFICIAL INTELLIGENCE

BY MS. NIDA E RUB


[email protected]
GROUND RULES
 No mobile phones (switched off during the class)
 Arrive on time!
 If you do not understand a point, raise your hand and ask me to explain
or contact during office hours
 No disturbance!!!! No Misconduct!!!!
 REMEMBER:
 Your first priority must be your studies.
 No politics, no social networking and other sources that wastes you and your
career.
 Efficient time management
AIM OF THE COURSE

 Introduce basics of A.I.

 Build a foundation upon which expertise can be acquired.


Email Spam Detection
Spam is any kind of
unwanted, unsolicited digital
communication that gets
sent out in bulk
Traditional Programming Approach (Rule-Based)

def is_spam(email):
spam_words = ["win", "free", "money", "urgent", "click here"]
if any(word in email.lower() for word in spam_words):
return True
return False

# Example email
email = "Congratulations! You have won free money. Click here to claim your prize."
result = is_spam(email)
print(f"Is this email spam? {'Yes' if result else 'No'}")

Issues with Traditional Approach:


1.Limited by Rules:You need to manually create many rules, and some spam emails might not match
these patterns.
2.Hard to Scale: As spam techniques evolve, updating the rules continuously becomes a challenge.
3.Low Flexibility: It can't learn from new patterns automatically. If spammers change tactics (e.g., use
new words), the program fails.
AI Programming Approach (Machine Learning)
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.naive_bayes import MultinomialNB

# Example dataset
emails = [
"Congratulations! You have won free money.",
"Hey, can we meet tomorrow for lunch?",
"Click here to claim your urgent prize!",
"Let's catch up next week.",
]
labels = [1, 0, 1, 0] # 1: Spam, 0: Not Spam

# Convert emails into a format that a machine learning model can understand
vectorizer = CountVectorizer()
X = vectorizer.fit_transform(emails) Benefits of the AI Approach:
1.Learns Patterns Automatically: The model learns
# Train a Naive Bayes model
model = MultinomialNB()
from the data, recognizing complex patterns beyond
model.fit(X, labels) simple keyword matching.
2.Scalable: Once trained, the model can classify millions
# Test with a new email
of emails efficiently without needing manual rule updates.
test_email = ["Win free tickets now!"]
X_test = vectorizer.transform(test_email) 3.Adaptive: The model can be retrained on new data to
prediction = model.predict(X_test) keep up with evolving spam techniques, making it much
more flexible than a rule-based approach.
print(f"Is this email spam? {'Yes' if prediction[0] == 1 else 'No'}")
Sklearn: A popular machine learning library in Python

CountVectorizer : Converting a collection of text documents into a numerical representation


• https://towardsdatascience.com/basics-of-countvectorizer-e26677900f9c

Naive_bayes: Naive Bayes methods are a set of supervised learning algorithms based on applying Bayes’ theorem
with the “naive” assumption of conditional independence between every pair of features given the value of the class variable.

vectorizer.fit_transform: it creates a dictionary of tokens (by default the tokens are words separated by spaces and
punctuation) that maps each single token to a position in the output matrix.
The fit() method calculates the various required parameters, and the transform() method applies the calculated
parameters to standardize the data.

MultinomialNB(): The multinomial Naive Bayes classifier is suitable for classification with discrete features
(eg, word counts for text classification).

model.predict: When you call model. predict on a set of input data, you receive an array containing the model's predictions
for each input sample.
Traditional programming relies on
explicit rules defined by the programmer,
which makes it efficient for well-defined,
structured tasks but limited in flexibility
and adaptability.

AI programming, on the other hand, learns from


data, making it highly flexible, adaptable, and
capable of handling complex, unstructured tasks
like email spam detection.
It reduces human effort in defining every
possible rule, making it much more efficient in
dynamic environments.
COURSE PLAN
Course Contents

An Introduction to Artificial Intelligence and its applications towards


Knowledge Based Systems, Introduction to Reasoning and Knowledge
Representation, Problem Solving by Searching (Informed searching,
Uninformed searching, Heuristics, Local searching, Minmax algorithm, Alpha
beta pruning, Game-playing), Case Studies: General Problem Solver, Eliza,
Student, Macsyma; Learning from examples, ANN and Natural Language
Processing, Recent trends in AI and applications of AI algorithms.

DEPARTMENT OF COMPUTING, FCIT, INDUS UNIVERSITY


TEXT & REFERENCE BOOKS
 Artificial Intelligence : A modern
approach, by Stuart Russell and Peter
Norvig
 Artificial Intelligence: Structures and
Strategies for Complex Problem Solving,
by Luger and Stubblefiled
 Artificial Intelligence, by Elaine Rich and
Kevin Knight
COURSE LEARNING OUTCOMES (CLOS)

Artificial Intelligence (2023)


Credit Hours: 3+1 Prerequisites: Object Oriented Programming

Course Learning Outcomes (CLOs):


At the end of the course, the students will be able to: Domain BT Level*

1. Understand the fundamental constructs of Python programming 2


C
language (Understand)

2
2. Understand key concepts in the field of artificial intelligence. C
(Understand)
3
3. Implement artificial intelligence techniques and case studies C
(Apply)

DEPARTMENT OF COMPUTING, FCIT, INDUS UNIVERSITY


MARKS DISTRIBUTION (TENTATIVE)
Activity Marks
Assignments  3 8
Quizzes  3 12
Mid Terms 30
Finals 40
Project 10
What Is Intelligence?
WHAT IS INTELLIGENCE ?

Self
Understand
awareness
and Learn Thinking out
( I think Adaptability
from of the box
therefore I
experience
am )

Problem
solving Capacity to Objective
ability / know or and unbiased Think beyond
decision understand thinking expectation
making
INTELLIGENCE FOR COMPUTER SCIENTIST?
 Set of cognitive skills

Abstract Ability to
Ability to learn from
Thinking experience
and understand
and adapt to
reasoning complex a changing
ideas environment.
Problem Ability to
Solving acquire
knowledge
AI DEFINITION BY JOHN MCCARTHY

 What is an artificial intelligence?


 It is the science and engineering of making
intelligent machines, especially intelligent
computer programs
 Intelligence is the computational part of the ability
to achieve goals in the world
Father of AI

http://www-formal.stanford.edu/jmc/whatisai/whatisai.html
WHAT IS AN AI?

 Studies how to achieve intelligent behavior through


computational means.
 The study of agents that receive percepts from the environment
and perform actions.
 Each such agent implements a function that maps percept
sequences to actions.
FOUR CATEGORIES OF AI DEFINITIONS

Thinking Humanly Thinking Rationally Thought

Behavior

Human performance metric: involving observations and Ideal or rational performance metric: combination of
hypothesis mathematics and engineering
Thinking Humanly
1 (The Cognitive Modelling
Approach)

• The cognitive approach aims to develop AI


systems that can mimic human thought
processes and behaviors, such as perception,
reasoning, and problem-solving.

• This approach emphasizes the importance


of understanding human cognition and how
it can be replicated in machines, rather than
focusing solely on statistical or
mathematical models.
APPROACH 1: THINKING HUMANLY
The cognitive modeling approach
 “The art of creating machines that perform functions that
require intelligence when performed by people.” (Kurzweil,
1990)
 One example of the cognitive approach is the development of
expert systems, which are computer programs that can solve
complex problems in a particular domain, such as medical
diagnosis or financial planning.
Acting Humanly
2 • Acting humanly, also known as the Turing
Test approach, is an approach to artificial
intelligence (AI) and machine learning that
focuses on creating machines that can
simulate human-like behavior and thought
processes to the point where they are
indistinguishable from humans.
APPROACH 2: ACTING HUMANLY
The Turing Test approach
 Turing Test: ultimate test for acting humanly
 Computer and human both interrogated by judge
If the response of a
 Computer passes test if judge can’t tell the difference computer to an
unrestricted textual
natural-language
conversation cannot be
distinguished from that
of a human being then
it can be said to be
intelligent.
Thinking Rationally
3 • Thinking rationally, or the laws of thought
approach is an approach to artificial
intelligence (AI) and machine learning that is
based on the principles of formal logic and
reasoning.
• The laws of thought approach aims to
develop AI systems that can reason logically
and make decisions based on a set of
predefined rules.
APPROACH 3: THINKING RATIONALLY
The “laws of thought” approach

 The Greek philosopher Aristotle attempted this


 To codify “right thinking,” that is, irrefutable reasoning processes.
 Provide patterns for argument structures that always yielded correct conclusions
when given correct premises— Logic
 These laws of thought were supposed to govern the operation of the mind

 Provided foundation of much of AI


 Not all intelligent behavior controlled by logic.
p “Hasan’s PC has more than 16 GB free hard disk space”

q “The processor in Hasan’s PC runs faster than 1 GHz.”

&^-⊕

Notation Examples:
• p&q
• p^
• -p
• p⊕q
APPROACH 3: THINKING RATIONALLY

Logic!
 Socrates is a man, All men are mortal, Therefore Socrates is mortal.

Once you have Facts, and a set of rules for


manipulating facts, you can (automatically) derive
conclusions (prove theorems)

 We will study logic and the limits of theorem proving


APPROACH 3: THINKING RATIONALLY
Logic!
 Two limitations for the logic implementation!
 Not easy to take informal knowledge and state it in the formal terms
required by logical notations, particularly when the knowledge is less
than 100% certain.

 Second, there is a big difference between solving a problem “in


principle” and solving it in practice. A lot of resources are required
practically.
4
Acting Rationally

• Acting rationally, also known as


the rational agent approach, is an approach
to artificial intelligence (AI) and machine
learning that focuses on creating intelligent
agents that can act in the world to achieve
their goals.
APPROACH 4: ACTING RATIONALLY
The rational agent approach

 The rational agent approach is based on the idea of rationality,


which involves making decisions that maximize the chances of
achieving one's goals, given the available information and
resources.
 Rational behavior is doing the “right thing”
 Thing which expects to maximize goal achievement
A BRIEF HISTORY OF AI
 1940-1950: Early days  1970—90: Knowledge-based approaches

 1943: McCulloch & Pitts: Boolean circuit  1969—79: Early development of knowledge-
model of brain based systems

 1950: Turing's “Computing Machinery and  1980—88: Expert systems industry booms
Intelligence”  1988—93: Expert systems industry busts:
“AI Winter”

 1950—70: Excitement
 1950s: Early AI programs, including Samuel's  1990—: Statistical approaches
checkers program, Newell & Simon's Logic  Resurgence of probability, focus on
Theorist, Gelernter's Geometry Engine uncertainty
 1956: Dartmouth meeting: “Artificial  General increase in technical depth
Intelligence” adopted
 Agents and learning systems… “AI Spring”?
BRIEF HISTORY OF AI

 2012—: Deep learning


 2012: ImageNet & AlexNet

You might also like