UNIT II · AI & ML Knowledge Representation & Concept Learning From representing facts with logic and rules to learning concepts by searching hypothesis spaces. Predicate Logic Rule - Based KR Find - S Candidate Elimination Inductive Bias For Engineering Students · Detailed Course Deck MAP Unit Roadmap — What We Will Cover Two connected themes: representing knowledge, then learning concepts from data Unit II · Knowledge Representation & Concept Learning 2 PART A Knowledge Representation 2.1 Knowledge representation issues 2.2 Predicate logic 2.3 Representing knowledge using rules PART B Concept Learning 2.4 Concept learning task 2.5 Concept learning as search 2.6 Find - S algorithm 2.7 Candidate Elimination algorithm 2.8 Inductive bias of Candidate Elimination GOALS Learning Objectives By the end of this unit you should be able to: Unit II · Knowledge Representation & Concept Learning 3 1 Represent State the key issues in representing knowledge and the properties of a good representation scheme. 2 Reason Use predicate logic and production rules to encode facts and infer new conclusions. 3 Formulate Define a concept - learning problem in terms of instances, hypotheses, and target concept. 4 Search Explain concept learning as search ordered by the general - to - specific relation. 5 Apply Trace Find - S and Candidate Elimination on data to obtain hypotheses and version spaces. 6 Analyse Describe the inductive bias of these learners and why bias is necessary. P A R T A Knowledge Representation 2.1 Representation issues · 2.2 Predicate logic · 2.3 Rules 2.1 What Is Knowledge Representation? Unit II · Knowledge Representation & Concept Learning 5 Definition Knowledge representation (KR) is the area of AI concerned with encoding knowledge about the world in a form a computer system can store, reason with, and use to solve problems. • A representation is a set of syntactic and semantic conventions for describing things. • It links real - world facts to internal symbol structures the machine manipulates. • Good KR makes the knowledge explicit, concise, and easy to reason over. • It is the bridge between perception/data and intelligent behaviour. Symbols Facts encoded as structures Inference Derive new facts from known ones Knowledge Facts + ways to use them 2.1 Data → Information → Knowledge Each layer adds context and usefulness for reasoning Unit II · Knowledge Representation & Concept Learning 6 1 DATA Raw symbols & signals 42, “Sunny”, 0/1 bits — no meaning on their own 2 INFORMATION Data with context “Temperature = 42 ° C today” — organised, interpretable 3 KNOWLEDGE Information + rules of use “If temp > 40 ° C then issue heat alert” — actionable 4 WISDOM / INFERENCE Applied knowledge Choosing the right action across situations KR is mainly concerned with the upper layers — turning information into structured, usable knowledge. 2.1 The Representation Mapping Reasoning happens in the representation, then maps back to the world Unit II · Knowledge Representation & Concept Learning 7 Real World (Facts) Internal Representation Spot is a dog Spot has a tail dog(Spot) hasTail(Spot) represent interpret inference ∀ x dog(x) → hasTail(x) Desired reasoning in the world is achieved by reasoning over the representation and mapping the result back. 2.1 Knowledge Representation Issues (1 of 2) Recurring questions every KR scheme must answer Unit II · Knowledge Representation & Concept Learning 8 1 Important attributes Which properties are so common they deserve special treatment? e.g. isa and instance relations appear in almost every domain. 2 Relationships among attributes Inverses, existence in an isa hierarchy, techniques for reasoning about values, and single - valued attributes. 3 Choosing granularity At what level of detail should knowledge be represented? High - level facts vs. low - level primitives — a trade - off. 2.1 Knowledge Representation Issues (2 of 2) Unit II · Knowledge Representation & Concept Learning 9 4 Representing sets of objects How to assert properties of a whole set efficiently (e.g. “all dogs have tails”) instead of object by object. 5 Finding the right structure Given a large knowledge base, how do we access the relevant facts when needed? Indexing and matching matter. 6 The frame problem How to represent what changes and — just as importantly — what stays the same when an action occurs. 2.1 Properties of a Good Representation Four criteria used to judge any KR scheme (Rich & Knight) Unit II · Knowledge Representation & Concept Learning 10 1 Representational Adequacy Able to represent all the kinds of knowledge needed in the domain. 2 Inferential Adequacy Able to manipulate structures to derive new knowledge from old. 3 Inferential Efficiency Can focus the inference mechanism using guides/heuristics toward useful directions. 4 Acquisitional Efficiency Easy to acquire new knowledge, ideally automatically, and add it to the base. 2.1 Approaches to Knowledge Representation Different schemes trade expressiveness against efficiency Unit II · Knowledge Representation & Concept Learning 11 Approach Idea Example Relational / simple Facts as relations (tables) among attributes Database of attributes Inheritable Class hierarchy where properties pass to subclasses Frames, semantic nets, isa links Inferential Formal logic to deduce new facts from axioms Predicate (first - order) logic Procedural Knowledge encoded as procedures / how - to rules Production rules, scripts 2.2 Predicate Logic — Why Go Beyond Propositions? Unit II · Knowledge Representation & Concept Learning 12 Propositional logic • Atoms are whole statements that are true or false. • P = “Socrates is a man”, Q = “Socrates is mortal”. • Cannot talk about objects, properties, or relations inside a statement. • No quantifiers — cannot say “all” or “some”. Predicate (first - order) logic • Breaks statements into objects, predicates, and relations. • man(Socrates), mortal(Socrates) • Adds quantifiers ∀ (for all) and ∃ (there exists). • ∀ x man(x) → mortal(x) • Far more expressive — the basis of inferential KR. 2.2 Syntax of Predicate Logic The building blocks of first - order formulas Unit II · Knowledge Representation & Concept Learning 13 Constants Specific objects Marcus, 5, Caesar Variables Stand for objects x, y, z Predicates Properties / relations man(x), loyalto(x,y) Functions Map objects to objects father - of(x) Connectives Combine formulas ¬ ∧ ∨ → Quantifiers Range over objects ∀ (all) ∃ (exists) A well - formed formula (wff) combines these following precise grammar rules. 2.2 Quantifiers: ∀ and ∃ Unit II · Knowledge Representation & Concept Learning 14 ∀ Universal — “for all” ∀ x man(x) → mortal(x) • Usually pairs with → (implication). • True only if the body holds for every object. • “Every man is mortal.” ∃ Existential — “there exists” ∃ x man(x) ∧ genius(x) • Usually pairs with ∧ (conjunction). • True if at least one object satisfies it. • “Some man is a genius.” 2.2 Translating English into Predicate Logic Practice converting natural - language sentences into wffs Unit II · Knowledge Representation & Concept Learning 15 English sentence Predicate - logic form Marcus was a man. man(Marcus) All Pompeians were Romans. ∀ x Pompeian(x) → Roman(x) Caesar was a ruler. ruler(Caesar) All Romans were loyal to Caesar or hated him. ∀ x Roman(x) → loyalto(x,Caesar) ∨ hate(x,Caesar) Everyone is loyal to someone. ∀ x ∃ y loyalto(x,y) People only try to assassinate rulers they are not loyal to. ∀ x ∀ y person(x) ∧ ruler(y) ∧ tryassassinate(x,y) → ¬loyalto(x,y) 2.2 Inference in Predicate Logic How new facts are derived from a knowledge base Unit II · Knowledge Representation & Concept Learning 16 Modus Ponens From P and P → Q, conclude Q. man(Marcus), man(x)→mortal(x) ⊢ mortal(Marcus) Unification Find substitutions that make two literals identical. loyalto(Marcus,y) ≡ loyalto(x,Caesar) → {x/Marcus, y/Caesar} Resolution Refutation: assume the negation, derive a contradiction (empty clause). Convert to clause form, resolve complementary literals 2.2 Worked Example — Is Marcus Loyal to Caesar? Reasoning over a small first - order knowledge base Unit II · Knowledge Representation & Concept Learning 17 Knowledge base 1. man(Marcus) 2. Pompeian(Marcus) 3. ∀ x Pompeian(x) → Roman(x) 4. ruler(Caesar) 5. ∀ x Roman(x) → loyalto(x,Caesar) ∨ hate(x,Caesar) 6. tryassassinate(Marcus,Caesar) 7. ∀ x ∀ y person(x) ∧ ruler(y) ∧ tryassassinate(x,y) → ¬loyalto(x,y) Chain of inference 1 Pompeian(Marcus) + (3) ⇒ Roman(Marcus) 2 Roman(Marcus) + (5) ⇒ loyalto ∨ hate 3 man ⇒ person(Marcus); ruler(Caesar) 4 (7) with tryassassinate ⇒ ¬loyalto(Marcus,Caesar) Conclusion: Marcus was NOT loyal to Caesar 2.3 Representing Knowledge Using Rules Production rules: IF condition THEN action/conclusion Unit II · Knowledge Representation & Concept Learning 18 IF antecedent (conditions are true) THEN consequent (assert fact / take action) Example: IF animal barks AND animal has fur THEN animal is a dog Declarative knowledge • States WHAT is true — facts and relationships. • Separated from how it is used. • e.g. logic assertions, facts in a KB. Procedural knowledge • Encodes HOW to do something — control included. • Production rules embed reasoning steps. • e.g. expert - system rule bases. 2.3 Forward vs. Backward Chaining Two ways to apply production rules Unit II · Knowledge Representation & Concept Learning 19 Forward chaining Data - driven — start from facts, fire rules, derive new facts until the goal appears. Known facts Match rule conditions Assert new facts Goal reached? Backward chaining Goal - driven — start from the hypothesis, find rules that conclude it, prove their conditions. Goal / hypothesis Find rule concluding goal Prove sub - goals Facts confirm? A Part A Recap — Knowledge Representation Key ideas to carry into concept learning Unit II · Knowledge Representation & Concept Learning 20 2.1 KR issues Attributes, relationships, granularity, sets, structure, frame problem. 2.1 Good KR Representational + inferential adequacy, efficiency, easy acquisition. 2.2 Predicate logic Objects, predicates, quantifiers; inference by modus ponens, unification, resolution. 2.3 Rules IF – THEN production rules; forward (data) vs backward (goal) chaining.