Artificial Intelligence Knowledge engineering Fall 2008 professor Luigi

  • Slides: 46
Download presentation
Artificial Intelligence Knowledge engineering Fall 2008 professor: Luigi Ceccaroni

Artificial Intelligence Knowledge engineering Fall 2008 professor: Luigi Ceccaroni

Knowledge engineering • A knowledge engineer is someone who: – Investigates a particular domain

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.

The software engineering process: waterfall model 3

The software engineering process: waterfall model 3

The software engineering process: spiral model 4

The software engineering process: spiral model 4

The knowledge engineering process: general methodology

The knowledge engineering process: general methodology

Identify the task • Feasibility of the construction of the KBS • Search for

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

Assemble the relevant knowledge • Specification of the basic elements to characterize the domain

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 subproblems • Characterization of the reasoning flow

Vocabulary of predicates, functions and constants • Translation of the important domain-level concepts into

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.

Formalize and encode the knowledge about the domain • Determination of the necessary reasoning

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

Formalize and encode the knowledge about the domain • Analysis of inaccuracy (uncertainty, imprecision)

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

Encode a description of the specific problem instance • Problem instances are supplied by

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.

Pose queries to the inference procedure and get answers • Let the inference procedure

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.

Debug the knowledge base • Specification of a set of test cases • Evaluation

Debug the knowledge base • Specification of a set of test cases • Evaluation of the functioning of the system (prototype): – accuracy – completeness – credibility (explanations)

Types of KBSs (Clancey, 1985) • Analysis tasks: interpretation of a system – control

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

Analysis-oriented KBSs • Diagnosis oriented – Medical diagnosis, failures diagnosis • Classification oriented –

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

Synthesis-oriented KBSs • Planning oriented – Robot course planning • Design oriented – Architectural

Synthesis-oriented KBSs • Planning oriented – Robot course planning • Design oriented – Architectural design • Configuration oriented – Computer networks configuration

Practical problem-solving methods • Heuristic classification • Constructive problem-solving Helping expert-systems builders to make

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)

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

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 class 2. heuristic match of a general solution (method) to the problem class 3. 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.

Heuristic classification • HC can be applied in analysis tasks: – – – classification

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. 19

Heuristic classification problem class data abstraction concrete problem heuristic association principal solution refinement and

Heuristic classification problem class data abstraction concrete problem heuristic association principal solution refinement and adaptation concrete solution 20

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

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

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

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 data If has-fever and “other data” then Q has flu 22

Heuristic classification: example HUÉSPED PREDISPUESTO A LA INFECCIÓN PACIENTE INMUNODEFICIENTE INFECCIÓN POR BACTERIAS GRAMNEGATIVAS

Heuristic classification: example HUÉSPED PREDISPUESTO A LA INFECCIÓN PACIENTE INMUNODEFICIENTE INFECCIÓN POR BACTERIAS GRAMNEGATIVAS INFECCIÓN POR Escherichia coli LEUCOPENIA NIVEL DE LEUCOCITOS BAJO [MYCIN] Nº LEUCOCITOS < 2. 5 M 23

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

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-sinfondos. . . ) – Compromiso (créditos-anteriores. . . ) • Soluciones – – Denegación Aceptación con rebaja Aceptación con interés preferente 24

Heuristic classification: example Reglas de abstracción Bienes < 10 * petición → Bienes insuficientes

Heuristic classification: example Reglas de abstracción Bienes < 10 * petición → Bienes insuficientes Bienes ≥ 10 * petición ∧ Bienes < 20 * petición → Bienes suficientes Bienes ≥ 20 * petición → Bienes excelentes Avales ≥ 10 * petición ∨ Es-rico → Apoyo-financiero bueno Avales < 10 * petición ∧ Avales ≥ petición → Apoyo-financiero moderado Avales < petición → Apoyo-financiero bajo Cheques-sin-fondos ∨ Moroso → Fiabilidad-de-la-devolución baja Empresa es churrería ∨ Empresa es tienda de roba → Viabilidad buena Empresa es hamburguesería cerca de universidad → Viabilidad buena Empresa es Corte-Inglés ∨ Empresa es proveedor Internet vía cable → viabilidad muy buena Crédito < petición → Compromiso bajo Crédito ≥ petición ∧ Crédito < 10 * petición → Compromiso mediano Crédito ≥ 10 * petición → Compromiso alto 25

Heuristic classification: example Reglas de asociación heurística Apoyo-financiero bajo ∧ Bienes insuficientes → Denegación

Heuristic classification: example Reglas de asociación heurística Apoyo-financiero bajo ∧ Bienes insuficientes → Denegación Fiabilidad-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. . . 26

Heuristic classification: example Regles de refinamiento/adaptación de las soluciones Aceptación con rebaja ∧ Petición

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 27

Heuristic classification: example 28

Heuristic classification: example 28

Constructive problem-solving • Solutions can be infinite and do not need to be identified

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 –. . . 29

Constructive problem-solving • Solutions are combinations of certain elements, which satisfy some constraints: –

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. 30

Constructive problem-solving • The construction of the solution implies knowing: – a model of

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

Constructive problem-solving • Constraints can be: – On the configuration of the components of

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

Constructive problem-solving: example 1 • Planning of the (optimal) path of a robot exit

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. R 33

Constructive problem-solving: example 2 • Configure/place a set of furniture/objects in a room –

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. Wii Sofa 34

Constructive problem-solving: sub-methods • Propose and apply – The problem needs to be decomposed

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

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

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

Propose and apply • Exhaustive knowledge is needed about: – Operators, and their effect

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

Propose and apply: resolution process 1. Goal initialization (task to be carried out): necessary

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

Least commitment • The method starts from a complete state. • At each step,

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. 39

Least commitment: resolution process 1. Start with a complete, non optimal state, which satisfies

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

Least commitment: example • Queremos planificar la mejor trayectoria de un robot en una

Least commitment: example • Queremos planificar la mejor trayectoria de un robot en una habitación • La habitación tiene un conjunto de obstáculos 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 41

Least commitment: example 42

Least commitment: example 42

Least commitment: example • Restricciones globales: llegar a la puerta de salida, trayectoria mínima

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 43 de nuestra trayectoria

Hierarchical hypothesize and test • La formación de hipótesis y pruebas organizadas jerárquicamente (HPJ)

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) 44

Hierarchical hypothesize and test: resolution process 1. Leer los datos iniciales del problema y

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 n 5. 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 <-- l 8. Tornar a 4

Hierarchical hypothesize and test: example • A hierarchical representation of lung diseases in CENTAUR

Hierarchical hypothesize and test: example • A hierarchical representation of lung diseases in CENTAUR