Presentation is loading. Please wait.

Presentation is loading. Please wait.

Artificial Intelligence

Similar presentations


Presentation on theme: "Artificial Intelligence"— Presentation transcript:

1 Artificial Intelligence
Knowledge Representation Problem 2

2 first-order logic for all x: (NOT(Knows(John, x)) OR IsMean(x) OR Loves(John, x)) John loves everything he knows, with the possible exception of mean things for all y: (Loves(Jane, y) OR Knows(y, Jane)) Jane loves everything that does not know her

3 Converting sentences to CNF
1. Eliminate all ↔ connectives (P ↔ Q)  ((P  Q) ^ (Q  P)) 2. Eliminate all  connectives (P  Q)  (P  Q) 3. Reduce the scope of each negation symbol to a single predicate P  P (P  Q)  P  Q (P  Q)  P  Q (x)P  (x)P (x)P  (x)P 4. Standardize variables: rename all variables so that each quantifier has its own unique variable name

4 Converting sentences 5. Eliminate existential quantification by introducing Skolem constants/functions (x)P(x)  P(c) c is a Skolem constant (a brand-new constant symbol that is not used in any other sentence) (x)(y)P(x,y)  (x)P(x, f(x)) since  is within the scope of a universally quantified variable, use a Skolem function f to construct a new value that depends on the universally quantified variable f must be a brand-new function name not occurring in any other sentence in the KB. E.g., (x)(y)loves(x,y)  (x)loves(x,f(x)) In this case, f(x) specifies the person that x loves

5 Generalized Modus Ponens

6 Modus Ponens - special case of Resolution
p Þ q p q Sunday Þ Dr Yasser is teaching AI Sunday Dr Yasser teaching AI Using the tricks: p Þ q Þ p p Þ p Ù q q, i.e. q

7 Sound rules of inference
Each can be shown to be sound using a truth table RULE PREMISE CONCLUSION Modus Ponens A, A  B B And Introduction A, B A  B And Elimination A  B A Double Negation A A Unit Resolution A  B, B A Resolution A  B, B  C A  C

8 An example 2. Eliminate  3. Reduce scope of negation
(x)(P(x)  ((y)(P(y)  P(f(x,y)))  (y)(Q(x,y)  P(y)))) 2. Eliminate  (x)(P(x)  ((y)(P(y)  P(f(x,y)))  (y)(Q(x,y)  P(y)))) 3. Reduce scope of negation (x)(P(x)  ((y)(P(y)  P(f(x,y))) (y)(Q(x,y)  P(y)))) 4. Standardize variables (x)(P(x)  ((y)(P(y)  P(f(x,y))) (z)(Q(x,z)  P(z)))) 5. Eliminate existential quantification (x)(P(x) ((y)(P(y)  P(f(x,y))) (Q(x,g(x))  P(g(x))))) 6. Drop universal quantification symbols (P(x)  ((P(y)  P(f(x,y))) (Q(x,g(x))  P(g(x)))))

9 Two broad kinds of rule system
forward chaining systems, and backward chaining systems. In a forward chaining system you start with the initial facts, and keep using the rules to draw new conclusions (or take certain actions) given those facts In a backward chaining system you start with some hypothesis (or goal) you are trying to prove, and keep looking for rules that would allow you to conclude that hypothesis, perhaps setting new subgoals to prove as you go.

10 Forward chaining Proofs start with the given axioms/premises in KB, deriving new sentences until the goal/query sentence is derived This defines a forward-chaining inference procedure because it moves “forward” from the KB to the goal [eventually]

11 Forward chaining Idea: fire any rule whose premises are satisfied in the KB, add its conclusion to the KB, until query is found

12 Forward chaining example

13 Backward chaining Proofs start with the goal query, find rules with that conclusion, and then prove each of the antecedents in the implication Keep going until you reach premises Avoid loops: check if new sub-goal is already on the goal stack Avoid repeated work: check if new sub-goal Has already been proved true Has already failed

14 Backward Chaining Is Tom faster than someone?

15 Forward chaining example
KB: allergies(X)  sneeze(X) cat(Y)  allergic-to-cats(X)  allergies(X) cat(Felix) allergic-to-cats(Lise) Goal: sneeze(Lise)

16 Exercise You go to the doctor and for insurance reasons they perform a test for a horrible disease You test positive The doctor says the test is 99% accurate Do you worry?

17 Reduction to propositional inference
Suppose the KB contains just the following: x King(x)  Greedy(x)  Evil(x) King(Ali) Greedy(Ali) Brother(Saad, Ali) Instantiating the universal sentence in all possible ways, we have: King(John)  Greedy(John)  Evil(John) King(Richard)  Greedy(Richard)  Evil(Richard) King(John) Greedy(John) Brother(Richard,John) The new KB is propositionalized: proposition symbols are King(John), Greedy(John), Evil(John), King(Richard), etc.

18 An example Sameh is a lawyer. Lawyers are rich.
Rich people have big houses. Big houses are a lot of work. We would like to conclude that Sameh’s house is a lot of work.

19 Axiomatization 1 lawyer(Sameh) x lawyer(x)  rich(x)
x rich(x)  y house(x,y) x,y rich(x)  house(x,y)  big(y) x,y ( house(x,y)  big(y)  work(y) ) 3 and 4, say that rich people do have at least one house and all their houses are big. Conclusion we want to show: house(Sameh, S_house)  work(Sameh, S_house) Or, do we want to conclude that Sameh has at least one house that needs a lot of work? I.e. y house(Sameh,y)  work(y)

20 Hassan and the cat Every animal owner is an animal lover
Everyone who loves all animals is loved by someone. Anyone who kills an animal is loved by no one. Mustafa owns a dog. Either Mustafa or Hassan killed the cat, who is named SoSo. Did Hassan kill the cat?

21 Practice example Did Hassan kill the cat
Mustafa owns a dog. Every dog owner is an animal lover. No animal lover kills an animal. Either Hassan or Mustafa killed the cat, who is named SoSo . Did Hassan kill the cat? These can be represented as follows: A. (x) Dog(x)  Owns(Mustafa ,x) B. (x) ((y) Dog(y)  Owns(x, y))  AnimalLover(x) C. (x) AnimalLover(x)  ((y) Animal(y)  Kills(x,y)) D. Kills(Mustafa ,SoSo)  Kills(Hassan,SoSo) E. Cat(SoSo) F. (x) Cat(x)  Animal(x) G. Kills(Hassan, SoSo) GOAL

22 Add the negation of query:
Convert to clause form A1. (Dog(D)) A2. (Owns(Mustafa,D)) B. (Dog(y), Owns(x, y), AnimalLover(x)) C. (AnimalLover(a), Animal(b), Kills(a,b)) D. (Kills(Mustafa,SoSo), Kills(Hassan,SoSo)) E. Cat(SoSo) F. (Cat(z), Animal(z)) Add the negation of query: G: (Kills(Hassan, SoSo))

23 The resolution refutation proof
R1: G, D, {} (Kills(Mustafa,SoSo)) R2: R1, C, {a/Mustafa, b/SoSo} (~AnimalLover(Mustafa), ~Animal(SoSo)) R3: R2, B, {x/Mustafa} (~Dog(y), ~Owns(Mustafa, y), ~Animal(SoSo)) R4: R3, A1, {y/D} (~Owns(Mustafa, D), ~Animal(SoSo)) R5: R4, A2, {} (~Animal(SoSo)) R6: R5, F, {z/SoSo} (~Cat(SoSo)) R7: R6, E, {} FALSE

24 The proof tree G D {} R1: K(J,T) C {a/J,b/T} R2: AL(J)  A(T) B
{x/J} R3: D(y)  O(J,y)  A(T) A1 {y/D} R4: O(J,D), A(T) A2 {} R5: A(T) F {z/T} R6: C(T) A {} R7: FALSE

25 Example knowledge base
The law says that it is a crime for an American to sell weapons to hostile nations. The country Nono, an enemy of America, has some missiles, and all of its missiles were sold to it by Colonel West, who is American. Prove that Col. West is a criminal

26 Example knowledge base
... it is a crime for an American to sell weapons to hostile nations: American(x)  Weapon(y)  Sells(x,y,z)  Hostile(z)  Criminal(x) Owns(Nono,M1) and Missile(M1) … all of its missiles were sold to it by Colonel West Missile(x)  Owns(Nono,x)  Sells(West,x,Nono) Missile(x)  Weapon(x) An enemy of America counts as "hostile“: Enemy(x,America)  Hostile(x) American(West) Enemy(Nono,America)

27 Resolution proof: definite clauses

28 Rule-Based Systems Also known as “production systems” or “expert systems” Rule-based systems are one of the most successful AI paradigms Used for synthesis (construction) type systems Also used for analysis (diagnostic or classification) type systems

29 Rule-Based Systems Instead of representing knowledge in a relatively declarative, static way (as a bunch of things that are true), rule-based system represent knowledge in terms of a bunch of rules that tell you what you should do or what you could conclude in different situations. A rule-based system consists of a bunch of IF-THEN rules, a bunch of facts, and some interpreter controlling the application of the rules, given the facts.

30 IF (lecturing X) AND (marking-practicals X) THEN ADD (overworked X)
IF (month february) THEN ADD (lecturing ali) IF (month february) THEN ADD (marking-practicals ali) IF (overworked X) OR (slept-badly X) THEN ADD (bad-mood X) IF (bad-mood X) THEN DELETE (happy X) IF (lecturing X) THEN DELETE (researching X)

31 Rule Based Reasoning The advantages of rule-based approach:
The ability to use Good performance Good explanation The disadvantage are Cannot handle missing information Knowledge tends to be very task dependent

32 Other Reasoning There exist some other approaches as:
Case-Based Reasoning Model-Based Reasoning Hybrid Reasoning Rule-based + case-based Rule-based + model-based Model-based + case-based

33 Expert System An Expert System is a computer program that represents and reasons with knowledge of some specialist subject with a view to solving problems or giving advice It is practical program that use heuristic strategies developed by humans to solve specific class of problems

34 Expert System Functionality
replace human expert decision making when not available assist human expert when integrating various decisions provides an ES user with an appropriate hypothesis methodology for knowledge storage and reuse expert system – software systems simulating expert-like decision making while keeping knowledge separate from the reasoning mechanism

35 Parties in XS world Human Expert Can solve problems; we desire to solve the problems without her. Knowledge Engineer Can communicate with HE to obtain and model the knowledge that we need in the system Programmer Builds and maintains all the necessary computer programs User Wants to use expertise to solve problems (better, cheaper)

36 Expert System User Interface Knowledge editor Question&Answer
Natural Language Graphical interface Knowledge editor User General Knowledge Inference Engine Case-specific data Explanation

37 Expert System Components
Global Database content of working memory (WM) Production Rules knowledge-base for the system Inference Engine rule interpreter and control subsystem

38 Rule-Based System knowledge in the form of if condition then effect (production) rules reasoning algorithm: (i) FR  detect(WM) (ii) R  select(FR) (iii) WM  apply R (iv) goto (i) conflicts in FR: examples – CLIPS (OPS/5), Prolog

39 The Structure of ES INFERENCE ENGINE
Knowledge processor which is modeled after the expert reasoning power. Processor in an expert system that matches the facts contained in the working memory with the domain knowledge contained in the knowledge base, to draw conclusion about the problems. It taps the knowledge base and working memory to derive new information and solve problems

40 The Structure of ES THE USER INTERFACE
The user communicates with the expert system through the user interface. It allows the user to query the system, supply information and receive advice. The aims are to provide the same form of communication facilities provided by the expert. But normally has less capability of understanding natural language and general knowledge.

41 The Structure of ES THE EXPLANATION FACILITY
A trademark of expert systems: ability to explain their reasoning. An additional component of expert system. ES can provide explanation on: WHY it is asking the question HOW it reached some conclusion.

42 Main challenges in Expert Systems field
Acquiring knowledge Expert is unaware, uncommunicative, busy, unwilling Representing knowledge Facts, Relations, Conclusions, Meta-knowledge Controlling reasoning Selection between alternatives is guided by higher order knowledge (meta rules) Explanation Sequence of reasoning steps? Interpretation at higher level Why were other steps NOT chosen? Quality evaluation; acceptance Acquisition: fortunately there are a lot of nice and cooperative experts. It is a pity that they are not computer scientists so they can give us their knowledge directly in computer-readable form. And they make a lot of money per hour, and they have a lot of clients waiting, and … Controlling: plans and STRIPS-like approaches help a lot, but never enough.

43 Weaknesses of Expert Systems
Require a lot of detailed knowledge Restrict knowledge domain Not all domain knowledge fits rule format Expert consensus must exist Knowledge acquisition is time consuming Truth maintenance is hard to maintain Forgetting bad facts is hard

44 Expert Systems in Practice
XCON/R1 classical rule-based system configuration DEC computer systems commercial application, well used, followed by XSEL, XSITE failed operating after 1700 rules in the knowledge base FelExpert rule-based, baysian model, taxonomised, used in a number of applications ICON configuration expert system uses proof planning structure of methods

45 Selected Business Expert Systems and Functions
Developer Business Function Activity AS/ASO Arthur Andersen Accounts Receivable Aid auditing procedures Authorizers Assistant American Express Consumer Credit Evaluate credit records to protect against credit card fraud Helpdesk advisor Publix Supermarkets Retailing Handle problem calls from store managers

46 Selected Business Expert Systems and Functions
Developer Business Function Activity Intelligent Secretary Nippon T & T Personnel Coordinate schedules of company personnel Mortgage loan Analyzer Arthur Andersen Banking Help loan officer make final decisions on home mortgage loan Direct Labor Mgmt System (DLMSISIS) Ford Motor Company Manufacturing Improve efficiency in all phases of the production process

47 Selected Business Expert Systems and Functions
Developer Business Function Activity Inspector Banking Monitor Worldwide foreign exchange trading to identify irregular activities Prohibited Transaction Exemption (TPE) Analyst Law Help attorney evaluate transactions subject to Employee Retirement Income security Act Personnel Policy Expert Personnel Help devise employee policies & write employee handbooks;

48 MYCIN: A medical expert system
Developed at Stanford University in the mid 1970's. The first large expert system that perform at the level of human expert and use as benchmark by expert system developers. Provide consultative advise about bacteremia and meningitis. Bacteremia is an infections that involve bacteria in the blood.

49 MYCIN: A medical expert system
Meningitis is an infection which is an inflammation of the membranes that envelop the brain and spinal cord. Can be fatal, thus need quick response, but positive identification normally takes hours. Normally doctors must begin treatment in the absence of lab results. Very complex and doctor need advice of an expert of bacteremia and meningitis.

50 How MYCIN reasons? Laboratory results of body fluid analyses
Symptoms that patient is displaying Characteristics of the patient such as age, sex etc.

51 MYCIN MYCIN consultative proceeds in 2 phases:
Diagnosis is made to identify the most likely infection organisms Prescribe one or more drugs (antibiotics)

52 MYCIN: Example of a rule
IF the stain of the organism is gram-positive AND the morphology of the organism is coccus, AND the growth conformation of the organism is clumps, THEN there is suggestive evidence (0.7) that the identity of the organism is staphyloccus

53 A consultation With MYCIN
1. Please enter information about the patient. Name Age Sex Race Sally 42 years Female Melayu 2. Are there any positive cultures obtained from SALLY? No 3. Are there any pending cultures of SALLY? Yes 4. Site: date collected: stain examined: method CSF 3-Jun Yes N/A 5. Stain of smear: (type NONE if no organism was seen on the smear) None (Unable to reach conclusion from lab test, like physician continue asking questions.)

54 A consultation With MYCIN (cont..)
6. Has Sally recently had symptoms of persistent headache or other abnormal neurologic symptoms(dizziness, lethargy etc.) Yes 7. Has SALLY recently had objective evidence of abnormal neurologic signs documented by physician observation of examination? Questions 6 and 7 traditional approach to diagnose by symptoms. Conclude from the questions by giving first conclusion. Conclusion: The CSF cultures will be considered to be associated with MENINGITIS.

55 A consultation With MYCIN (cont..)
The following questions will identify particular organism that cause the infections. 8. Is the meningitis a hospital-acquired infection? Yes 9. Is SALLY clinical history consistent with EPIGLOTTITIS? No 10. Is Sally clinical history consistent with OTITIS-MEDIA? 11. Has the patient ever been to an area that is endemic for coccidiomycoses? Unknown 12. Is Sally a burn patient? Yes (Why) Conclusion: The type of infection may be BACTERIAL.

56 A consultation With MYCIN (cont..)
The final phase, prescription of antibiotics. 13. Does SALLY have clinically significant allergic reaction to any antimicrobial agent? No 14. Is Sally pregnant of breast feeding? 15. Do you have reason to suspect that SALLY may have impaired renal functions? 16. SALLY weight in kilograms? 51.4

57 A consultation With MYCIN
My preferred therapy recommendation is as follows: Give the following combination: 1. ETHAMBUTAL Dose: 1.28g ( mg tablets) q24h PO for 60 days then 770 mg ( mg tablets) q24h PO. Comments: periodic vision screening tests are recommended for optic neuritis. 2. INH Dose: 513 mg ( mg-tablets) q24h PO 3. RIFAMPIN Dose: 600 mg PO q24h Comments: Administer dose on empty stomach.

58


Download ppt "Artificial Intelligence"

Similar presentations


Ads by Google