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

AI for Business Applications

Unit 1: Introduction to AI

Faculty Name : Dr. Shivangi Agarwal


Index

Lec.-1: Dissemination of Institute & department vision-mission, PEO, POs, PSO, COs & POs
mapping

Lec.-2: Introduction to Artificial Intelligence (AI)

Lec.-3: Introduction to Machine Learning (ML)

Lec.-4: Introduction to Neural Networks (NN) and Deep Learning (DL)

Lec.-5: Introduction to Natural Language Processing (NLP)

Lec.-6: Introduction to Rule-based Expert Systems

Lec.-7: Introduction to Recommendation Engines

Lec.-8: Employing AI in business

2
Lecture 4

Introduction to
Neural Network (NN) &
Deep Learning (DL)
What is NN?

• Also known as a spiking


neuron models
• Action potentials or spikes:
generate sharp electrical
potentials across their cell
membrane (approx. 1 ms).
• Transmitted along the axon
and synapses from the
sending neuron to many
other neurons,
• A major information Biological neuron models
processing unit of the
nervous system.

Source: en.wikipedia.org/wiki/Biological_neuron_model

4 Lec-4: Introduction to NN & DL


What is Artificial Neural Network (ANN)?

• Derived from Biological neural networks that develop the structure of a human
brain.
• Artificial neurons or nodes (ෝ
= neurons) interconnected to one another in various
layers of the networks.

Biological NN Artificial NN

Dendrites Inputs
Cell nucleus Nodes
Synapse Weights
Axon Output

5 Lec-4: Introduction to NN & DL


History of ANN

1943, Warren McCulloch & Walter Pitts: Created a computational model for neural
networks.

1949, D. O. Hebb: Created a learning hypothesis based on the mechanism of neural


plasticity, known as Hebbian learning.

1954, Farley & Wesley A. Clark: Simulate a Hebbian network using computational
machines ("calculators“).

1958, Frank Rosenblatt: Invented the perceptron, first artificial neural network.

6 Lec-4: Introduction to NN & DL


History of ANN

1960, Kelley & 1961 Bryson: Derived the basics of continuous backpropagation using
principles of dynamic programming.

1965, Ivakhnenko and Lapa: Published first functional multi-layered networks, as the
Group Method of Data Handling.

1969, Minsky and Papert: Discovered that basic perceptrons were incapable of
processing the EXOR circuit & that computers lacked sufficient power to process useful
neural networks.

7 Lec-4: Introduction to NN & DL


ANN architecture

Source: T. Jain et al. “Application of polynomial chaos theory as an accurate and


computationally efficient proxy model for heterogeneous steam‐assisted gravity
drainage reservoirs,” Energy Sci. & Engg., 5, 2017.

8 Lec-4: Introduction to NN & DL


9
Artificial Neural Network (ANN) (short version)

Neural Network In 5 Minutes

10 Lec-4: Introduction to NN & DL


Artificial Neural Network (ANN) (long version)

But what is a neural network?

11 Lec-4: Introduction to NN & DL


Gradient descent in ANN

Gradient descent, how neural networks learn

12 Lec-4: Introduction to NN & DL


Deep Learning (DL)

• Originated around 1970s.

• Traditional ML face a problem of feature extraction.


o Some patterns are much smaller than the whole image

o Same pattern appears in different places.

• Subset of AL and ML that uses specialized NN for solving complex problems.

13 Lec-4: Introduction to NN & DL


Convolution Neural Network

• A neural network with some convolutional layers (and some other layers).

• A number of filters that does convolutional operation.

Kernel function or
feature extractor

Filter

14 Lec-4: Introduction to NN & DL


Convolution

Network parameters to be learned.

1 0 0 0 0 1 1 -1 -1
0 1 0 0 1 0 -1 1 -1 Filter 1
0 0 1 1 0 0 -1 -1 1 Each filter
detects a small
1 0 0 0 1 0 pattern.
-1 1 -1
0 1 0 0 1 0 Filter 2
-1 1 -1
0 0 1 0 1 0
-1 1 -1
Image

15 Lec-4: Introduction to NN & DL


Color image: RGB 3 channels

1 -1 -1 -1 1 -1
1 1 -1-1 -1-1 -1 1 -1
-1 1 -1 -1 -11 1-1 -1
-1-1 1 1 -1-1 -1 1 -1
-1 -1 1 Filter 1 -1 -11 1-1 -1 Filter 2
-1-1 -1-1 1 1 -1 1 -1
-1 1 -1

1 0 0 0 0 1
1 0 0 0 0 1
0 11 0 00
0 01 00 1
0 1 0 0 1 0
0 00 11 01 00 10 0
0 0 1 1 0 0
1 00 00 10 11 00 0
1 0 0 0 1 0
0 11 00 00 01 10 0
0 1 0 0 1 0
0 00 11 00 01 10 0
0 0 1 0 1 0
0 0 1 0 1 0
Color image

Lec-4: Introduction to NN & DL


Cat vs Dog CNN detector

cat or dog

Convolution

Fully Connected
Feedforward network Max Pooling

Convolution
May
repeat

Flatten Max Pooling

17 Lec-4: Introduction to NN & DL


Alphago

AlphaGo Zero: Starting from scratch


18 Lec-4: Introduction to NN & DL
AlphaGo

Next move
ANN (19 x 19
positions)

19 x 19 matrix
Black: 1
white: -1
none: 0
19 Lec-4: Introduction to NN & DL
AlphaGo’s policy network

Note: AlphaGo does not use Max Pooling.

20 Lec-4: Introduction to NN & DL


CNN in speech recognition

Filters move across frequencies.


CNN
Frequency

Image Time
Spectrogram

Lec-4: Introduction to NN & DL


CNN in text classification

Source: doi=10.1.1.703.6858
22 Lec-4: Introduction to NN & DL
Lecture 5

Introduction to
Natural Language Processing (NLP)
NLP in 5 min

Natural Language Processing In 5 Minutes


24 Lec.-5: Introduction to NLP
Why NLP?

• Understand language analysis & generation


• Communication
• Language is a window to the mind
• Data is in linguistic form
• Data can be in Structured (table form), Semi structured (XML form),
Unstructured (sentence form).

25 Lec.-5: Introduction to NLP


What is NLP?

• Subfield of AI concerned with interaction of computers with human languages.


• Computer imitates the human communication.
• Used in:
o Speech recognition
o Machine translation
o Sentiment analysis
o Name & entity recognition
o Chatbot, etc.

• Two Contrasting Views of Language:


o Language as a phenomenon
o Language as a data

26 Lec.-5: Introduction to NLP


Language Processing

• Level 1 – Speech sound (Phonetics & Phonology)

• Level 2 – Words & their forms (Morphology, Lexicon)

• Level 3 – Structure of sentences (Syntax, Parsing)

• Level 4 – Meaning of sentences (Semantics)

• Level 5 – Meaning in context & for a purpose (Pragmatics)

• Level 6 – Connected sentence processing in a larger body of text


(Discourse)

27 Lec.-5: Introduction to NLP


Examples of Levels

• L1 : sound
• L2 : Dog - Dog(s), Dog(ged)
Lady – Lad(ies)
Should we store all forms of words in the lexicon?
• L3 : Ram goes to market (right)
goes Ram to the market (wrong)
• L4 : translation from unstructured to structured representation
go : (event)
agent : Ram
source : ?
destination : market

28 Lec.-5: Introduction to NLP


Example (Contd.)

• L5 : User situation & context


“Is that water?” – the action to be performed is different in a chemistry
lab and on a dining table.
• L6 : Backward & forward references –
• Coreference resolution
“The man went near the dog. It bit him.”
Often co reference & ambiguity go together as in –
“The dog went near the cat. It bit it.”

29 Lec.-5: Introduction to NLP


Ambiguity in Natural Language

Ambiguity can be of 2 types –


• Lexical – multiple meanings of words
o It is dealt with in “lexical semantics”
o “The bank organized a loan mela on the bank of the river”

• Structural
o It is dealt with in parsing.
o “I saw the boy with a telescope”

• Referential
o Aries during the use of pronounces for referencing.
o “The father lost the boy in zoo. He was very worried.”

30 Lec.-5: Introduction to NLP


Tokenization

• Break a complex sentence into words.


• Understand & assign importance to each word according to the context.
• Each token may contain more than one word:
o Bi-gram
➢ Token of two consecutive words
➢ ‘The best’, ‘most beautiful’, …
o Tri-gram
➢ Token of three consecutive words
➢ ‘can not be’, …
o N-gram
➢ Token of many consecutive words

31 Lec.-5: Introduction to NLP


NLP- Tokenization with coding example

NLP - Tokenization
32 Lec.-5: Introduction to NLP
Stemming

• Normalize the word/token into their base or normal form


o Affect: affected, affection, affecting, …
o Giv: giving, given, give, …
• Different pre-trained stemmers are available
• Language, context -dependent

33 Lec.-5: Introduction to NLP


Lemmatization

• Lemma: different inflected parts of the same word


• Group together different lemma
• Similar to stemming but output is always a proper word
o Go: gone, going, went, …

34 Lec.-5: Introduction to NLP


NLP- Turning sentences into data

NLP- Turning sentences into data


35 Lec.-5: Introduction to NLP
Syntax tree

• A tree representation of syntactic structure of sentences or strings

• Very useful for generating a reply by NLP

Source: www.edureka.co/python-natural-language-processing-course
36 Lec.-5: Introduction to NLP
NLP- Training an AI to create poetry

NLP- Training an AI to create poetry


37 Lec.-5: Introduction to NLP
Lecture 5

Introduction to
Rule-based Expert Systems
Rule-based Expert system

• Rule-based system: Uses rules as the knowledge representation for


knowledge coded into the system (Knowledge-based rules) to solve a
problem
• Expert system: Computer program designed to solve complex problems
& to provide decision-making ability like a human expert
• Aim: Take knowledge from a human expert and convert this into a
number of hardcoded rules to apply to the input data
• In their most basic form, the rules are commonly conditional statements
(if a, then do x, else if b, then do y)
• Should be applied to smaller problems
o More complex a system, more rules required to describe it
o Increased difficulty to model for all possible outcomes

39 Lec.-6: Introduction to Rule-based ES


Characteristics of Expert System

• High Performance: Provides high performance for solving any type of


complex problem of a specific domain with high efficiency & accuracy.

• Understandable: Responds in a way that can be easily understandable


by the user. It can take input in human language and provides the output
in the same way.

• Reliable: Reliable for generating an efficient and accurate output.

• Highly responsive: Provides the result for any complex query within a
very short period of time.

40 Lec.-6: Introduction to Rule-based ES


Elements of a Rule-Based System

A SET OF FACTS
• Assertions relevant to the beginning state of the system
• A collection of data and conditions.

A Set Of Rules
• All actions that should be taken within the scope of a problem specify
how to act on the assertion set
• Relates the facts in the IF part to some action in the THEN part
• Should contain only relevant rules & avoid the irrelevant ones

A TERMINATION CRITERION
• A condition that determines that a solution has been found or that none
exists
• Necessary to terminate some rule-based systems that find themselves in
infinite loops otherwise
41 Lec.-6: Introduction to Rule-based ES
Rule

• Type of knowledge representation,


• Defined as an IF-THEN structure that relates given THEN structure
• IF part: antecedent (premise or condition) gives information or facts
• THEN part: consequent (conclusion or
• action)gives some action
• Relatively easy to create and understand. easy to create and understand.
• Can have multiple antecedents joined by the keywords AND
(conjunction), OR (disjunction) or a combination of both
• Antecedent of a rule incorporates two parts: an object (linguistic object
linguistic object) and its value linked by an operator

42 Lec.-6: Introduction to Rule-based ES


Rule

• Operator identifies the object and assigns the value


• Operators such as ‘is, are, is not, are not’ used to assign a symbolic value
to a linguistic object
• Can also use mathematical operators to define an object and assign it to
the numerical value
• Can represent:
• Relation
o IF the ‘fuel tank’ is empty THEN the car is dead
• Recommendation
o IF the season is autumn AND the sky is cloudy AND the forecast is
drizzle THEN the advice is ‘take an umbrella’

43 Lec.-6: Introduction to Rule-based ES


Rule

• Directive
o IF the car is dead AND the ‘fuel tank’ is empty THEN the action is
‘refuel the car’
• Strategy
o IF the car is dead THEN the action is ‘check the fuel tank’; the action
is ‘check the fuel tank’; step1 is complete
IF step1 is complete AND the ‘fuel tank’ is full the ‘fuel tank’ is full
THEN the action is ‘check the battery’; the action is ‘check the
battery’; step2 is complete
• Heuristic
o IF the spill is liquid AND the ‘spill pH’ < 6 AND the ‘spill smell’ is
vinegar the ‘spill smell’ is vinegar THEN the ‘spill material’ is ‘acetic
acid’ the ‘spill material’ is ‘acetic acid’

44 Lec.-6: Introduction to Rule-based ES


Structure of rule-based expert system

Source: 10.1109/ISMSIT.2018.8567251
45 Lec.-6: Introduction to Rule-based ES
Complete structure of rule-based expert system

THE KNOWLEDGE BASE


• Contains the domain knowledge useful for problem solving
• Represented as a set of rules and has the IF (condition) THEN (action)
structure
• When the condition is satisfied, the rule is said to fire and the action
part is executed

DATABASE
• Set of facts used to match against the IF (condition) parts of rules

INFERENCE ENGINE
• Carries out the reasoning whereby the expert system reaches a
solution
• Links the rules given in the knowledge base with the facts provided in
the database

46 Lec.-6: Introduction to Rule-based ES


Complete structure of rule-based expert system

EXPLANATION FACILITIES
• Enable the user to ask the expert system how a particular conclusion is
reached & why a specific fact is needed
• Explain its reasoning & justify its advice, analysis or conclusion

USER INTERFACE
• Communication between a user seeking a solution to the problem and
an expert system

47 Lec.-6: Introduction to Rule-based ES


Advantages of rule-based expert systems

• Natural knowledge representation: Explains the problem-solving


procedure solving procedure with expressions like “In such-and-such
situation, I such situation, I do so-and-so”. These expressions can be so”.
These expressions can be represented quite naturally as IF-THEN
production THEN production rules
• Uniform structure: Production rules have the uniform IF-THEN structure.
Each rule is an independent piece of knowledge. The very syntax of
production rules enables them to be self documented
• Separation of knowledge from its processing: Structure provides an
effective separation of the knowledge base from the inference engine &
thus makes it possible to develop different applications using the same
expert system shell
• Dealing with incomplete and uncertain knowledge: Most rule-based
expert systems are capable of representing and reasoning with
incomplete and uncertain knowledge
48 Lec.-6: Introduction to Rule-based ES
Disadvantages of rule-based expert systems

• Opaque relations between rules: Although the individual production


rules are relatively simple and self-documented, their logical interactions
within large set of rules may be opaque & make it difficult to observe how
individual rules serve the overall strategy
• Ineffective search strategy: The inference engine applies an exhaustive
search through all the production rules during each cycle. Expert systems
with a large set of rules (over 100 rules) can be slow, and thus can be
unsuitable for real-time applications
• Inability to learn: Do not have an ability to learn from the experience.
Unlike a human expert, who knows when to “break the rules”, an expert
system cannot when to “break the rules”, automatically modify its
knowledge base, or adjust existing rules or add new ones.

49 Lec.-6: Introduction to Rule-based ES


HE vs ES vs TP

Human Experts (HE) Expert systems (ES) Traditional programs (TP)


Use knowledge in the form Process knowledge Process data & use
of rules of thumb or expressed in the form of algorithms, a series of well-
heuristics to solve rules & use symbolic defined operations, to
problems in a narrow reasoning to solve narrow- solve general numerical
domain domain problems problems

In a human brain, Provide a clear separation Do not separate


knowledge exists in a of knowledge from its knowledge from control
compiled form processing structure to process it
Capable of explaining a Trace rules fired during a Do not explain how a
line of reasoning and problem-solving & explain particular result was
providing the details how conclusion was obtained and why input
reached & why specific data was needed
data was needed

50 Lec.-6: Introduction to Rule-based ES


HE vs ES vs TP

Human Experts (HE) Expert systems (ES) Traditional programs (TP)


Use inexact reasoning & Permit inexact reasoning Work only on problems
can deal with incomplete, and can deal with where data is complete
uncertain and fuzzy incomplete, uncertain & and exact
information fuzzy data
Can make mistakes for Can make mistakes for Provide no solution at all,
incomplete or fuzzy data incomplete or fuzzy data or a wrong one for
incomplete or fuzzy data
Enhance problem solving Enhance problem solving Enhance problem solving
quality via years of quality by adding new quality by changing the
learning and practical rules or adjusting old ones. program code, which
training. This process is When affects both the knowledge
slow, inefficient and new knowledge is and its processing, making
expensive acquired, changes are changes difficult
easy to accomplish

51 Lec.-6: Introduction to Rule-based ES


Thank You

You might also like