Artificial Intelligence Knowledge engineering Fall 2008 professor: Luigi Ceccaroni.

46
Artificial Intelligence Knowledge engineering Fall 2008 professor: Luigi Ceccaroni

Transcript of Artificial Intelligence Knowledge engineering Fall 2008 professor: Luigi Ceccaroni.

Page 1: Artificial Intelligence Knowledge engineering Fall 2008 professor: Luigi Ceccaroni.

Artificial IntelligenceKnowledge engineering

Fall 2008

professor: Luigi Ceccaroni

Page 2: Artificial Intelligence Knowledge engineering Fall 2008 professor: Luigi Ceccaroni.

Knowledge engineering

• A knowledge engineer is someone who:– Investigates a particular domain– Learns what concepts are important in that

domain– Creates a formal representation of the objects

and relations in the domain

• Knowledge engineering is a process for developing special-purpose knowledge bases:– whose domain is carefully circumscribed and – whose range of queries is known in advance.

Page 3: Artificial Intelligence Knowledge engineering Fall 2008 professor: Luigi Ceccaroni.

3

The software engineering process: waterfall model

3

Page 4: Artificial Intelligence Knowledge engineering Fall 2008 professor: Luigi Ceccaroni.

4

The software engineering process: spiral model

4

Page 5: Artificial Intelligence Knowledge engineering Fall 2008 professor: Luigi Ceccaroni.

The knowledge engineering process: general methodology

Page 6: Artificial Intelligence Knowledge engineering Fall 2008 professor: Luigi Ceccaroni.

Identify the task

• Feasibility of the construction of the KBS• Search for the sources of knowledge

(experts, books, Internet)• Specification of necessary data to solve

the problem• Specification of the goals (solutions) or of

the criteria which define the solution

Page 7: Artificial Intelligence Knowledge engineering Fall 2008 professor: Luigi Ceccaroni.

Assemble the relevant knowledge

• Specification of the basic elements to characterize the domain (relevant facts) and their relations

• Distinction between evidences, hypotheses and actions to be carried out

• Specification of the different hypotheses and goals

• Decomposition of the problem into sub-problems

• Characterization of the reasoning flow

Page 8: Artificial Intelligence Knowledge engineering Fall 2008 professor: Luigi Ceccaroni.

Vocabulary of predicates, functions and constants

• Translation of the important domain-level concepts into logic-level names– Questions of knowledge engineering style:

• “Should pits be independent objects or a unary predicate on square objects?”

• “Should the agent’s orientation be a function or a predicate?”

• “Should the agent’s location depend on time?”

• Once the choices have been made, the result is a “vocabulary” that is known as the ontology of the domain.

Page 9: Artificial Intelligence Knowledge engineering Fall 2008 professor: Luigi Ceccaroni.

Formalize and encode the knowledge about the domain

• Determination of the necessary reasoning schemas:– classification– diagnosis– temporal planning– causal structures

• Identification of the search space and the type of search

• Identification of the resolution methodology:– heuristic classification– constructive problem-solving– hierarchical hypothesize and test

Page 10: Artificial Intelligence Knowledge engineering Fall 2008 professor: Luigi Ceccaroni.

Formalize and encode the knowledge about the domain

• Analysis of inaccuracy (uncertainty, imprecision) and completeness

• Implementation of the representation– Facts base– Modular structure of the knowledge base– Inference rules of each module

• Decisions on the control of the resolution– Meta-rules associated to the modules– Other meta-rules

Page 11: Artificial Intelligence Knowledge engineering Fall 2008 professor: Luigi Ceccaroni.

Encode a description of the specific problem instance

• Problem instances are supplied by the sensors or, in general, they are generic input data with a certain structure and semantics.

• It involves writing simple atomic sentences about instances of concepts that are already part of the ontology.

Page 12: Artificial Intelligence Knowledge engineering Fall 2008 professor: Luigi Ceccaroni.

Pose queries to the inference procedure and get answers

• Let the inference procedure operate on the rules, axioms and problem-specific facts to derive the facts we are interested in knowing.

Page 13: Artificial Intelligence Knowledge engineering Fall 2008 professor: Luigi Ceccaroni.

Debug the knowledge base

• Specification of a set of test cases• Evaluation of the functioning of the system

(prototype):– accuracy– completeness– credibility (explanations)

Page 14: Artificial Intelligence Knowledge engineering Fall 2008 professor: Luigi Ceccaroni.

14

Types of KBSs (Clancey, 1985)

• Analysis tasks: interpretation of a system– control– prediction (simulation)– identification (monitoring, diagnosis)

• Synthesis tasks: construction of a system – design (planning, configuration)– assemblage (modification)– specification

14

Page 15: Artificial Intelligence Knowledge engineering Fall 2008 professor: Luigi Ceccaroni.

Analysis-oriented KBSs

• Diagnosis oriented– Medical diagnosis, failures diagnosis

• Classification oriented– User profiling, species identification

• Supervision oriented– Real-time process supervision

• Prediction oriented– Meteorology, stock-market prediction

Page 16: Artificial Intelligence Knowledge engineering Fall 2008 professor: Luigi Ceccaroni.

Synthesis-oriented KBSs

• Planning oriented– Robot course planning

• Design oriented– Architectural design

• Configuration oriented– Computer networks configuration

Page 17: Artificial Intelligence Knowledge engineering Fall 2008 professor: Luigi Ceccaroni.

Practical problem-solving methods

• Heuristic classification• Constructive problem-solving

Helping expert-systems builders to make the right design decisions with respect to the methods and representations most suitable for their application will do much to prevent the frustration and disillusion that often accompany bad decisions. (Peter Jackson, Introduction to expert systems, 1990)

Page 18: Artificial Intelligence Knowledge engineering Fall 2008 professor: Luigi Ceccaroni.

Heuristic classification

• Heuristic classification has been identified as a widespread problem solving method.

• It is comprised of three main phases:1.abstraction from a concrete, particular problem

description to a problem class2.heuristic match of a general solution (method)

to the problem class3.refinement of the general solution to a concrete

solution for the concrete problem

• To be applied, a finite set of solutions needs to be identified a priori.

Page 19: Artificial Intelligence Knowledge engineering Fall 2008 professor: Luigi Ceccaroni.

19

Heuristic classification

• HC can be applied in analysis tasks:– classification– diagnosis– identification– monitoring– ...

• It is used for complex problems.• If the problem is simple, a direct association

between data and solutions is enough.

Page 20: Artificial Intelligence Knowledge engineering Fall 2008 professor: Luigi Ceccaroni.

20

Heuristic classification

concreteproblem

problemclass

principalsolution

concretesolution

heuristic association

data abstractionrefinement

and adaptation

Page 21: Artificial Intelligence Knowledge engineering Fall 2008 professor: Luigi Ceccaroni.

Heuristic classification

• Data abstraction– Data of the specific case are abstracted to

obtain a more general case– Types of abstraction/generalization:

•Based on taxonomy•From quantitative to qualitative measures:

Temperature de Q = 38 ºC

If Temperature > 37.5 ºC then Temperature is high

21

Page 22: Artificial Intelligence Knowledge engineering Fall 2008 professor: Luigi Ceccaroni.

Heuristic classification

• Heuristic association (matching)– Determining the relation between abstract

cases and abstract solutions

If Temperature is high then has-fever

• Refinement and adaptation of the solution– Identifying specific solutions from abstract

solutions and complementary dataIf has-fever and “other data” then

Q has flu 22

Page 23: Artificial Intelligence Knowledge engineering Fall 2008 professor: Luigi Ceccaroni.

Heuristic classification: example

23

Nº LEUCOCITOS < 2.5 M

LEUCOPENIA

NIVEL DE LEUCOCITOSBAJO

PACIENTE INMUNODEFICIENTE

HUÉSPED PREDISPUESTOA LA INFECCIÓN

INFECCIÓN POR BACTERIASGRAMNEGATIVAS

INFECCIÓN POREscherichia coli

[MYCIN]

Page 24: Artificial Intelligence Knowledge engineering Fall 2008 professor: Luigi Ceccaroni.

24

Heuristic classification: example

Concesión de créditos para fundar una nueva empresa•Atributos (ejemplos)

– Apoyo financiero (tiene avales, es-rico...)– Petición (106 €...)– Bienes (cuentas-corrientes, casas, coches, yates...)– Fiabilidad-de-la-devolución (morosidad, cheques-sin-

fondos...)– Compromiso (créditos-anteriores...)

•Soluciones– Denegación– Aceptación– Aceptación con rebaja– Aceptación con interés preferente

Page 25: Artificial Intelligence Knowledge engineering Fall 2008 professor: Luigi Ceccaroni.

25

Heuristic classification: exampleReglas de abstracción

Bienes < 10 * petición → Bienes insuficientesBienes ≥ 10 * petición ∧ Bienes < 20 * petición → Bienes suficientesBienes ≥ 20 * petición → Bienes excelentesAvales ≥ 10 * petición ∨ Es-rico → Apoyo-financiero buenoAvales < 10 * petición ∧ Avales ≥ petición → Apoyo-financiero

moderadoAvales < petición → Apoyo-financiero bajoCheques-sin-fondos ∨ Moroso → Fiabilidad-de-la-devolución bajaEmpresa es churrería ∨ Empresa es tienda de roba → Viabilidad buenaEmpresa es hamburguesería cerca de universidad → Viabilidad buenaEmpresa es Corte-Inglés ∨ Empresa es proveedor Internet vía cable →

viabilidad muy buenaCrédito < petición → Compromiso bajoCrédito ≥ petición ∧ Crédito < 10 * petición → Compromiso medianoCrédito ≥ 10 * petición → Compromiso alto

Page 26: Artificial Intelligence Knowledge engineering Fall 2008 professor: Luigi Ceccaroni.

26

Heuristic classification: example

Reglas de asociación heurística

Apoyo-financiero bajo ∧ Bienes insuficientes → DenegaciónFiabilidad-de-la-devolución baja → Denegación. . .Apoyo-financiero moderado ∧ Bienes suficientes ∧

Viabilidad buena → Aceptación con rebaja . . .Apoyo-financiero bueno ∧ Bienes suficientes ∧ Compromiso mediano

∧ Viabilidad buena → Aceptación. . .Apoyo-financiero bueno ∧ Bienes excelentes ∧ Compromiso alto ∧

Viabilidad muy buena → Aceptación con interés preferente. . .

Page 27: Artificial Intelligence Knowledge engineering Fall 2008 professor: Luigi Ceccaroni.

27

Heuristic classification: example

Regles de refinamiento/adaptación de las soluciones

Aceptación con rebaja ∧ Petición < 107 ∧ Bienes < 5 * Petición → Rebaja a 0.6 * Petición. . .Aceptación con interés preferente ∧ Petición ≥ 107 ∧ Bienes ≥ 10 * Petición → Interés preferente: 1% inferior al del mercado

Page 28: Artificial Intelligence Knowledge engineering Fall 2008 professor: Luigi Ceccaroni.

Heuristic classification: example

28

Page 29: Artificial Intelligence Knowledge engineering Fall 2008 professor: Luigi Ceccaroni.

29

Constructive problem-solving

• Solutions can be infinite and do not need to be identified a priori.

• Solutions are constructed and not selected among various possibilities.

• Constructive problem-solving is applicable in synthesis tasks:– planning– design– ...

Page 30: Artificial Intelligence Knowledge engineering Fall 2008 professor: Luigi Ceccaroni.

30

Constructive problem-solving

• Solutions are combinations of certain elements, which satisfy some constraints:– Planning

• Elements are actions.

• Solutions are sequences of actions accomplishing a certain goal.

– Design• Elements are components.

• Solutions are combinations of components forming a complex object.

Page 31: Artificial Intelligence Knowledge engineering Fall 2008 professor: Luigi Ceccaroni.

31

Constructive problem-solving

• The construction of the solution implies knowing:– a model of the structure of the complex object– a model of the behavior of the complex object– a set of constraints on the complex object

31

Page 32: Artificial Intelligence Knowledge engineering Fall 2008 professor: Luigi Ceccaroni.

32

Constructive problem-solving

• Constraints can be:– On the configuration of the components of the

solution:• Physical/spatial constraints:

– How to hold an object

– An object cannot be placed in a certain place

• Temporal constraints:– Which action is carried out first

– On the pre- and post-conditions of operator/actions– On the interaction between the previous ones

32

Page 33: Artificial Intelligence Knowledge engineering Fall 2008 professor: Luigi Ceccaroni.

33

Constructive problem-solving: example 1

• Planning of the (optimal) path of a robot exit a room with obstacles– Operators/actions:

• go forward (m); turn (degrees); go backward (m)

– Constraints:• The robot cannot touch any obstacle.

• At the and the robot has to be at the exit.

• Only the movements indicated by the operators are allowed.

33

R

Page 34: Artificial Intelligence Knowledge engineering Fall 2008 professor: Luigi Ceccaroni.

34

Constructive problem-solving: example 2

• Configure/place a set of furniture/objects in a room– Operators/actions:

• place-furniture (furniture, position); remove-furniture (furniture); swap-furniture (furniture-1, furniture-2); move-furniture (furniture, position)

– Constraints:• Doors and windows cannot be blocked

• All furniture has to be placed

• Only the operations indicated by the operators are allowed.

34

Wii

Sofa

Page 35: Artificial Intelligence Knowledge engineering Fall 2008 professor: Luigi Ceccaroni.

35

Constructive problem-solving: sub-methods

• Propose and apply– The problem needs to be decomposed into

tasks (sub-problems) with clear spatial/temporal relations among them.

– Operations, with their constraints and effects, need to be clearly defined.

• Least commitment– Partial solutions are needed to start, and are

then improved to get to the final solution.

35

Page 36: Artificial Intelligence Knowledge engineering Fall 2008 professor: Luigi Ceccaroni.

Propose and apply

• The method starts from an empty or incomplete initial state.

• Each step contributes to the completion of the solution.

• The best operator is chosen at each step.

36

Page 37: Artificial Intelligence Knowledge engineering Fall 2008 professor: Luigi Ceccaroni.

Propose and apply

• Exhaustive knowledge is needed about:– Operators, and their effect on the solution– Constraints and relations among components of the

solution– Quality of the solution

• Resolution can be through:– Sequential construction (It needs a lot of knowledge to

be efficient.)– Hierarchical task-decomposition (It is more efficient,

but needs decomposition operators.)

37

Page 38: Artificial Intelligence Knowledge engineering Fall 2008 professor: Luigi Ceccaroni.

38

Propose and apply: resolution process

1. Goal initialization (task to be carried out): necessary elements to identify the initial state are created.

2. Operator proposal: all operators that can actuate on the current state are considered.

3. Operator elimination: some operators are eliminated according to global criteria (e.g., predefined preference order).

4. Operator evaluation: the effects of the operators on the solution are compared using expert knowledge.

5. Operator selection: the operator with the best evaluation is selected.

6. Operator application: the selected operator is applied to the current state.

7. Goal evaluation: if the goal is reached, the process stops, otherwise it restarts from step 2. 38

Page 39: Artificial Intelligence Knowledge engineering Fall 2008 professor: Luigi Ceccaroni.

Least commitment

• The method starts from a complete state.• At each step, the state is

modified/improved/corrected.• The operator to be applied is defined by

the least commitment strategy:– The modification that imposes less future

constraints.

3939

Page 40: Artificial Intelligence Knowledge engineering Fall 2008 professor: Luigi Ceccaroni.

40

Least commitment: resolution process

1. Start with a complete, non optimal state, which satisfies the constraints.

2. Modify the state applying the least commitment heuristics: “Choose the operator that imposes less constraints on future actions”.

3. If the modification violates any constraints, then undo some of the previous steps, trying to minimize the undoing modifications.

4. If the goal is reached, the process stops, otherwise it restarts from step 2.

40

Page 41: Artificial Intelligence Knowledge engineering Fall 2008 professor: Luigi Ceccaroni.

Least commitment: example

• Queremos planificar la mejor trayectoria de un robot en una habitación

• La habitación tiene un conjunto de obstáculos que queremos evitar

• Disponemos de un conjunto de operadores:– Movernos hacia adelante o hacia atrás a

cierta velocidad y cierta distancia– Girar cierto número de grados

4141

Page 42: Artificial Intelligence Knowledge engineering Fall 2008 professor: Luigi Ceccaroni.

Least commitment: example

4242

Page 43: Artificial Intelligence Knowledge engineering Fall 2008 professor: Luigi Ceccaroni.

Least commitment: example

• Restricciones globales: llegar a la puerta de salida, trayectoria mínima en recorrido y tiempo

• Restricciones de elección de operadores: No chocar con obstáculos o la pared, mantener la distancia para poder maniobrar

• Evaluación de los operadores:– Mover: Mejor cuanto más lejos y más deprisa nos

lleve al objetivo– Girar: Mejor cuanto más lejos deje los obstáculos

de nuestra trayectoria4343

Page 44: Artificial Intelligence Knowledge engineering Fall 2008 professor: Luigi Ceccaroni.

44

Hierarchical hypothesize and test

• La formación de hipótesis y pruebas organizadas jerárquicamente (HPJ) combina aspectos de clasificación heurística y de resolución constructiva de problemas.

• Es indicada en problemas donde:

– El espacio de soluciones posibles es muy grande, pero estas toman valores en un dominio finito.

• El espacio de hipótesis (nodos de la resolución) está organizado jerárquicamente:

– Los nodos altos corresponden a hipótesis más generales, que se van refinando hasta llegar a las hojas que corresponden a hipótesis más concretas.

• La estructuración jerárquica ayuda a plantear el problema y facilita la solución.

• Ejemplos:

– CENTAUR (Aikins, 1983)

– INTERNIST (Pople, 1977)

– TEST (Kahn et al., 1987)

Page 45: Artificial Intelligence Knowledge engineering Fall 2008 professor: Luigi Ceccaroni.

Hierarchical hypothesize and test: resolution process

1. Leer los datos iniciales del problema y formular hipótesis.2. Asignar a cada hipótesis una puntuación que refleje la proporción

de los datos explicados.3. Determinar el mejor nodo según la puntuación: n.4. Si nodo-(n)-es-solución entonces acabar si no dividir el espacio de hipótesis en 2 conjuntos K i L K <-- sucesores de n L <-- competidores en espera de n5. Recoger más datos que discriminen entre las hipótesis de K y

puntuar-les.6. Sean: k <-- mejor (K) y l <-- mejor (L)7. Si puntuación (k) > puntuación (l) entonces n <-- k si no n <-- l8. Tornar a 4

Page 46: Artificial Intelligence Knowledge engineering Fall 2008 professor: Luigi Ceccaroni.

Hierarchical hypothesize and test: example

• A hierarchical representation of lung diseases in CENTAUR