Introduction To Common Lisp
Introduction To Common Lisp
Rules
Simple search
Search is finding a sequence of actions/operators that achieve a goal from an
initial state.
Idea: An agent that can predict the results of its actions can return better actions.
Assumptions: Operators are deterministic.
Relevant features of initial state and goal can be perceived
Means-ends analysis.
https://www.javatpoint.com/means-ends-analysis-in-ai
ElIZA
ELIZA is an early natural language processing computer program created from 1964 to
1966 at the MIT Artificial Intelligence Laboratory by Joseph Weizenbaum
Pattern matching
Pattern matching is the process of checking whether a specific
sequence of characters/tokens/data exists among the given data.
Regular programming languages make use of regular
expressions (regex) for pattern matching.
The software parses text and creates a transitional representation from which the
text in the target language is generated. This process requires extensive lexicons
with morphological, syntactic, and semantic information, and large sets of rules.
The software uses these complex rule sets and then transfers the grammatical
structure of the source language into the target language.
In most cases, there are two steps: an initial investment that significantly increases
the quality at a limited cost, and an ongoing investment to increase quality
incrementally. While rule-based MT brings companies to the quality threshold and
beyond, the quality improvement process may be long and expensive.
Statistical MT provides good quality when large and qualified corpora are
available. The translation is fluent, meaning it reads well and therefore meets user
expectations. However, the translation is neither predictable nor consistent.
Training from good corpora is automated and cheaper. But training on general
language corpora, meaning text other than the specified domain, is poor.
Furthermore, statistical MT requires significant hardware to build and manage
large translation models.
Rule-Based MT Statistical MT
+ Consistent and – Unpredictable translation quality
predictable quality
+ Out-of-domain – Poor out-of-domain quality
translation quality
+ Knows grammatical rules – Does not know grammar
+ High performance and – High CPU and disk space requirements
robustness
+ Consistency between – Inconsistency between versions
versions
– Lack of fluency + Good fluency
– Hard to handle exceptions + Good for catching exceptions to rules
to rules
– High development and + Rapid and cost-effective development costs
customization costs provided the required corpus exists
OPS-5
OPS5 is a rule-based or production system computer language, notable as
the first such language to be used in a successful expert system, the
R1/XCON system used to configure VAX computers. The OPS family was
developed in the late 1970s by Charles Forgy
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:
What to Represent:
Types of knowledge
2. Procedural Knowledge
3. Meta-knowledge:
4. Heuristic knowledge:
5. Structural knowledge:
AI knowledge cycle:
An Artificial intelligence system has the following components for
displaying intelligent behavior:
o Perception
o Learning
o Knowledge Representation and Reasoning
o Planning
o Execution
Player1 65 23
Player2 58 18
Player3 75 24
2. Inheritable knowledge:
o In the inheritable knowledge approach, all data must be
stored into a hierarchy of classes.
o All classes should be arranged in a generalized form or a
hierarchal manner.
o In this approach, we apply inheritance property.
3. Inferential knowledge:
o Inferential knowledge approach represents knowledge in the
form of formal logics.
o This approach can be used to derive more facts.
o It guaranteed correctness.
a. Marcus is a man
b. All men are mortal
Then it can represent as;
man(Marcus)
∀x = man (x) ----------> mortal (x)s
4. Procedural knowledge:
o Procedural knowledge approach uses small programs and
codes which describes how to do specific things, and how to
proceed.
o In this approach, one important rule is used which is If-
Then rule.
o In this knowledge, we can use various coding languages
such as LISP language and Prolog language.
o We can easily represent heuristic or domain-specific
knowledge using this approach.
o But it is not necessary that we can represent all cases in this
approach.
1. 1. Representational Accuracy:
KR system should have the ability to represent all kind of
required knowledge.
2. 2. Inferential Adequacy:
KR system should have ability to manipulate the
representational structures to produce new knowledge
corresponding to existing structure.
3. 3. Inferential Efficiency:
The ability to direct the inferential knowledge mechanism
into the most productive directions by storing appropriate
guides.
4. 4. Acquisitional efficiency- The ability to acquire the new
knowledge easily using automatic methods.
1. Logical Representation
Syntax:
o Syntaxes are the rules which decide how we can construct
legal sentences in the logic.
o It determines which symbol we can use in knowledge
representation.
o How to write those symbols.
Semantics:
o Semantics are the rules by which we can interpret the
sentence in the logic.
o Semantic also involves assigning a meaning to each
sentence.
a. Propositional Logics
b. Predicate logics
Statements:
a. Jerry is a cat.
b. Jerry is a mammal
c. Jerry is owned by Priya.
d. Jerry is brown colored.
e. All Mammals are animal.
3. Frame Representation
Example: 1
Slots Filters
Year 1996
Page 1152
Example 2:
Slots Filter
Name Peter
Profession Doctor
Age 25
Weight 78
4. Production Rules
Production rules system consist of (condition, action) pairs
which mean, "If condition then action". It has mainly three parts:
Example:
o IF (at bus stop AND bus arrives) THEN action (get into
the bus)
o IF (on the bus AND paid AND empty seat) THEN action
(sit down).
o IF (on bus AND unpaid) THEN action (pay charges).
https://www.javatpoint.com/rules-of-inference-in-artificial-intelligence
Natural language
Productions
Predicate logic
Semantic network
Frames
Objects
Scripts
A script is a structured representation describing a stereotyped sequence
of events in a particular context. Scripts are used in natural language
understanding systems to organize a knowledge base in terms of the
situations that the system should understand.
Searching
https://www.javatpoint.com/search-algorithms-in-ai
Hill climbing
https://www.javatpoint.com/hill-climbing-algorithm-in-ai
Min-max search.
https://www.javatpoint.com/mini-max-algorithm-in-ai
Symbolic Mathematics:
Simplification rules
Rewrite rules
Meta-rules
Macsyma
PRESS
ATLAS.
Logic Programming:
Logic programming is a programming paradigm which is largely based on formal logic.
Any program written in a logic programming language is a set of sentences in logical form,
expressing facts and rules about some problem domain.
Resolution
https://www.javatpoint.com/ai-resolution-in-first-order-logic#:~:text=Resolution%20is%20a
%20theorem%20proving,Robinson%20in%20the%20year%201965.&text=Resolution%20is%20a
%20single%20inference,normal%20form%20or%20clausal%20form.
https://www.tutorialandexample.com/resolution-method-in-ai/
Unification
https://www.javatpoint.com/ai-unification-in-first-order-logic#:~:text=Unification%20is%20a%20process
%20of,makes%20them%20identical%20using%20substitution.
horn-clause logic
https://artint.info/html/ArtInt_122.html#:~:text=A%20Horn%20clause%20is%20either,disjunctions
%20of%20negations%20of%20atoms.
Prolog
https://www.geeksforgeeks.org/prolog-an-introduction/
Prolog programming.
https://en.wikipedia.org/wiki/Prolog#Programming_in_Prolog
Sample case studies of shells and Knowledge Based Systems.
Knowledge representation formalisms & Inference KR Inference
1. Logic Resolution principle
2. Production rules backward (top-down, goal directed) forward
(bottom-up, data-driven)
3. Semantic nets & Frames Inheritance & advanced reasoning
4. Case-based Reasoning Similarity based
KBS tools - Shells
1. Consist of KA Tool
2. Database & Development Interface
3. Inductive Shells
simplest
example cases represented as matrix of known data (premises)
and resulting effects (conclusions)
matrix converted into decision tree or IF-THEN statements -
examples selected for the tool
o Rule-based shells - simple to complex –
o IF-THEN rules
4. Hybrid shells - sophisticate & powerful - support multiple KR
paradigms & reasoning schemes - generic tool applicable to a wide
range-
5. Special purpose shells - specifically designed for particular types of
problems - restricted to specialised problems
6. Scratch - require more time and effort - no constraints like shells -
shells should be investigated first
Some example KBSs(1)
1. DENDRAL (chemical)- Pioneering work developed in 1965 for NASA
at Stanford University by Buchanan & Feigenbaum- DENDRAL infers
the molecular structure given mass spectral data- Traditional method
of generate-and-test, difficulty: millions of possible structures might
be generated to account for data- Experts used rules-of-thumb to
weed-out structures that are unlikely to account for the data-
Encoded this expertise & produced program which performed as well
as an expert chemist
2. MYCIN (medicine)- Developed in 1970 at Stanford by Shortcliffe-
Assist internists in diagnosis and treatment of infectious diseases:
meningitis & bacterial septicemia- When patient shows signs of
infectious disease, culture of blood and urine set to lab (>24hrs) to
determine bacterial species- Given patient data (incomplete &
inaccurate) MYCIN gives interim indication of organisms that are
most likely cause of infection & drugs to control disease- Drug
interactions & already prescribed drugs taken into account- Able to
provide explanation of diagnosis (limited)
3. XCON/RI (computer) - Configures DEC’s VAX, PDP11 and µVAX - DEC
offers the customer a wide choice of components when purchasing
computer equipment, so that client achieves a custom-made system
- Given the customer’s order, configuration is made, perhaps
involving component replacement or addition - Problem: information
subject to rapid change & configuring a computer system requires
skills and effort - Since 1981, XCON with XSEL assists DEC agents in
drawing up orders.
4. DRILLING ADVISOR (industry) - Developed in 1983 by Teknowledge
for oil company to replace human drilling advisor - Problem:drill bits
becoming stuck - Difficulty: lack of subsurface information on
location & condition on end of drill - (scarcity) expert examines rock
pieces, mud, lubricant brought up by drilling to determine cause -
Drilling Advisor uses geological site information, conditions of
problem, historical information about other problems experienced in
the past - Provide recommendation to correct problem & advice on
how to change current practices to avoid problem
5. Human Resource Managementy HRM facilitates the most effective
use of employees to achieve organisational and individual goalsy
HRM KBS forms part of overall strategy (includes DSS & EIS)y KBS
helps decision making for HRM managers with heuristic knowledge in
unstructured & semi-structured problems (job placement & pay
rises)y Using semantic nets & Prolog, illustrates use of KBS in HR
planning, recruiting, compensation & labour- management relations
(see Human resource management expert systems technology, Byun
& Suh, ES, May 94, 11:2)
Typical tasks of KBS
1. Diagnosis - To identify a problem given a set of symptomsor
malfunctions.e.g. diagnose reasons for engine failure(2)
Interpretation - To provide an understanding of a situationfrom
available information. e.g. DENDRAL(3) Prediction - To predict a
future state from a set of data orobservations. e.g. Drilling Advisor,
PLANT(4) Design - To develop configurations that satisfy
constraintsof a design problem. e.g. XCON(5) Planning - Both short
term & long term in areas like projectmanagement, product
development or financial planning.e.g. HRM
2. Monitoring - To check performance & flag exceptions.e.g., KBS
monitors radar data and estimates the position ofthe space shuttle(7)
Control - To collect and evaluate evidence and form opinionson that
evidence.e.g. control patient’s treatment(8) Instruction - To train
students and correct their performance.e.g. give medical students
experience diagnosing illness(9) Debugging - To identify and
prescribe remedies formalfunctions.e.g. identify errors in an
automated teller machine network andways to correct the errors
Advantages & Limitations
1. Advantages - Increase availability of expert knowledge expertise not
accessible training future experts - Efficient and cost effective -
Consistency of answers - Explanation of solution - Deal with
uncertainty
2. Limitations -Lack of common sense -Inflexible, Difficult to modify -
Restricted domain of expertise - Lack of learning ability - Not always
reliable
Traditional AI & its limitations for real-world problem solving- KBS
emergence in 60’s emphasis on specific domain-knowledge rather than GPS
separation of knowledge and reasoning - KBS basic components:
knowledge-base, inference engine & user-interface- Examples- Advantages
& limitations
https://www.javatpoint.com/artificial-neural-network
https://pathmind.com/wiki/neural-network
Genetic Algorithm
https://www.javatpoint.com/artificial-neural-network-genetic-algorithm
Fuzzy Set
https://www.javatpoint.com/fuzzy-logic#:~:text=contradiction%20and%20tautologies%3A-,Fuzzy
%20Set,exist%20between%200%20and%201.