460 likes | 593 Views
Assignments. An Exercise in Building a KBS. Assignments. Goal s : E xercise in the building of a simple KBS Implementation of a simple knowledge base Implementation of a simple inference mechanism Implementation of a simple user interface Focus: initial steps to build a KBS
E N D
Assignments An Exercise in Building a KBS
Assignments • Goals: • Exercise in the building of a simple KBS • Implementation of a simple knowledge base • Implementation of a simple inference mechanism • Implementation of a simple user interface • Focus: • initial steps to build a KBS • choosing a KR methodology • defining & creating a knowledge base (KB) • facts and rules, semantic network, frames • define tasks in the domain • implement inference (search,backward/forward chaining, inheritance)
List of Assignments • Diagnosis • Diagnose faults in a PC based on observed malfunctions • Diagnose faults in a car/bike based on observed malfunctions • Prognosis • Predict weather conditions based on observations and recorded patterns • Predict stock market prices based on observations and recorded patters • Configuration • Construct PC/car/bike configuration for clients based on preferences/constraints
List of Assignments • Recommendation Systems • Recommend an MSc course to graduate students based on their preferences and capabilities • Recommend job opportunities to graduate students based on their preferences and capabilities • Recommend investments to clients based on their status (financial etc.) and needs, and on the market trends • Recommend package holidays to clients based on their status and preferences
List of Assignments • Classification & Taxonomic Organization • Build and reason with a taxonomy (classification) of vehicles • Recommendation to users based on needs (optionally) • Build and reason with a taxonomy (classification) of art items • Build and reason with a taxonomy (classification) of pieces of music • Etc.
List of Assignments • You can also propose any assignment you can think of • After a discussion with me
Diagnosis • Implementation of simple system that can diagnose faults in a PC based on observed malfunctions • The system could take as input facts describing malfunctions and return a description of the possible fault(s) • Forward chaining • Or it could take as input a possible fault and decide if the system suffers from it or not • Backward chaining
Diagnosis • Build a rule base using either: • A pseudo formal language (simple syntax must be defined) • Prolog • Implement a simple inference engine foryour domain • Forward chaining • Backward chaining • General search algorithms/heuristics • Some pattern matching code will be necessary
Diagnosis • Examples of rules • If antivirus program does not start and it is installed then computer is infected with virus or license has expired • If computer cannot boot then there is a disk error • If cannot connect to internet then modem is faulty or phone line is down • Rules can stored in a text file in some convenient syntax and structure
Diagnosis • The working memory will contain the facts entered by the user • Computer does not boot • MS Word does not start • Disk boot error message appears • Antivirus is installed • Phone line is OK • Etc. • Or the query about a possible fault • Is the CD-writer problematic?
Diagnosis • These facts/queries must be given in a convenient syntax as well • The working memory can be implemented as a (simple) data structure • a list, a queue, a stack, etc. • You can read all rules in memory and also store them in a (simple) data structure • But they must exist in a file (not hardwired in the program code!)
Diagnosis • If you use backward/forward chaining, at least two cycles must be executed for some task (not all of them necessarily)! • It is not OK if no facts are added or removed from working memory ever • It is not OK if all queries are answered by doing a match with a single rule and firing a single rule • This is a requirement in all assignments! • Assuming a rule-based KBS is implemented
Diagnosis - Deliverables • A text file containing the KB with the rules (and possibly some facts) • A text file containing the task/query definitions that you tried • Areport explaining how your inference engine works, what have youdone, why, and how queries are answered by your program • And of course… • The source code and executable files
Diagnosis - Deliverables • This assignment is for 2 students • 1if Prolog is used • Any other assignment from the diagnosis domain has similar requirements
Prognosis • Implementation of simple system that can predict weather conditions based on observations and recorded patterns • The system could take as input facts describing the weather and return a prediction of the weather for the next days • Forward chaining • Or it could take as input a possible weather condition and decide if it will occur (e.g. will it rain?) • Backward chaining
Prognosis • Build a rule base using either: • A pseudo formal language (simple syntax must be defined) • Prolog • Implement a simple inference engine foryour domain • Forward chaining • Backward chaining • General search algorithms/heuristics • Some pattern matching code will be necessary
Prognosis • Examples of rules • If it is hot and humid then it will rain • If sunny and summer then temperature>30 • If rain for past 5 days then will stop raining or rain for next 5 days • Rules can be stored in a text file in some convenient syntax and structure
Prognosis • The working memory will contain the facts entered by the user • Rain for past 5 days • Winter • Cloudy • Clouds from Southeast approaching • Yesterday’s temperature=21 • Etc. • Or the query about a possible fault • Will it rain tomorrow?
Prognosis • These facts/queries must be given in a convenient syntax as well • The working memory can be implemented as a (simple) data structure • a list, a queue, a stack, etc. • You can read all rules in memory and also store them in a (simple) data structure • But they must exist in a file (not hardwired in the program code!)
Prognosis • If you use backward/forward chaining, at least two cycles must be executed for some task (not all of them necessarily)! • It is not OK if no facts are added or removed from working memory ever • It is not OK if all queries are answered by doing a match with a single rule and firing a single rule • This is requirement in all assignments! • Assuming a rule-based KBS is implemented
Prognosis - Deliverables • A text file containing the KB with the rules (and possibly some facts) • A text file containing the task/query definitions that you tried • Areport explaining how your inference engine works, what have youdone, why, and how queries are answered by your program • And of course… • The source code and executable files
Prognosis - Deliverables • This assignment is for 2 students • 1if Prolog is used • Any other assignment from the prognosis domain has similar requirements
Classification & Taxonomic Organization • Implementation of a simple system in the domain of vehicle classification and (optionally) recommendation • The system should be able to conduct a simple dialogue with clients • i.e. answer simple queries and perform simple tasks posted by a client
Classification & Taxonomic Organization • draw a semantic network (or frame network) for your domain • use inheritance - 'subtype' object hierarchy (taxonomy) • use frames orentities/relations to describe conceptsand their attributes • Nodes or Frames • Vehicles and vehicle parts (cars, bikes, trucks, engines, etc.) • Features (links & attributes or slots) • size, width, max speed, acceleration, max number of passengers, max capacity, etc.
Classification & Taxonomic Organization • Transform the semantic (or frames) networkdiagram into a knowledge base (KB) using either: • facts & rules • a direct approach (hierarchies) • Prolog • If you don’t use Prolog you have to use a pseudo formal language • define the syntax of frames (nodes/links) or rules/facts
Classification & Taxonomic Organization • Define list of basic tasks/queries • Use pseudo formal language (define syntax) or Prolog • operations on vehicle items in the KB • Insert a new category or specific vehicle • client queries • Does a BMW 320i have a sunroof • Recommendation tasks (optional) • User enters a set of requirements and the system proposes a vehicle
Classification & Taxonomic Organization • Examples: • add new vehicle item in the KB • specify basic properties • answer queries about a vehicle item Depending on the KR method you choose you canalso define more complex tasks, such as: • 'explain' procedure that describes to a usercertain vehicles • 'profile' procedure that defines what the userlooks for • 'recognize' / match user'swishes with the vehicle types, etc.
Classification & Taxonomic Organization– If not Prolog then • Implement a simple inference engine foryour domain • Depending on the KR framework you choose it may be based on • Inheritance/graph navigation • Forward chaining • Backward chaining • Some pattern matching code will be necessary
Classification & Taxonomic Organization • You inference engine should be able to handle some (not necessarily all) of the tasks/queries you have defined • You choose which ones • If you use Prolog all tasks/queries must be implemented
Classification & Taxonomic Organization • Prepare a report containing explanationsfor: • Semantic (frames) network KB • pseudo (or Prolog) description in rules & factslanguage if used • Tasks/queries you have defined • The way your inference engine works • Reflection on problems & interesting issues inthis assignment
Classification & Taxonomic Organization - Deliverables • A semantic (frames) network diagram of the vehicle domain • A text file containing the vehicle KB with facts &rules or semantic (frames) network • A text file containing the task/query definitions • Areport explaining how your inference engine works, what have youdone, why, and how queries are answered by your program
Classification & Taxonomic Organization - Deliverables • And of course… • The source code and executable files • This assignment is for 2 students if only classification is implemented. Otherwise for 3
Classification • Implementation of a simple KBS that will be able to classify pieces of music into genres • Use frames • This assignment is for 2 students
Classification • draw a frame network for your domain • use inheritance - 'subtype' object hierarchy (taxonomy) • use frames to describe conceptsand their attributes • Frames • Pieces of music and genres(songs, pop, classical, dance, etc.) • Features (slots) • artist, duration, date, producer, etc.
Classification • Features (slots) • Write a daemon that will try to play the piece of music • Implement the KB directly as a network of frames • Implement an inference mechanism based on inheritance / graph navigation • Define a set of tasks/queries
Classification - Deliverables • A frames network diagram of the vehicle domain • A text file containing the vehicle KB with the frames network • A text file containing the task/query definitions • Areport explaining how your inference engine works, what have youdone, why, and how queries are answered by your program • Code/exe…
Recommendation Systems • Implementation of a simple system that will propose to a final year student potential MSc courses • The system should hold knowledge about various MSc courses • Their prerequisites • Their level of difficulty • Tuition fees • Other requirements • Etc.
Recommendation Systems • A student should be able to enter his/hers profile • Grades • Courses takes • Topic of final year project • Languages spoken • Etc. And the system should be able to propose MSc courses that fit the student’s profile
Recommendation Systems • Design and implement an MSc advisor rule-based system • Create a rule base using either • A pseudo formal language (define syntax) • Prolog • Knowledge about specific MSc courses can either be entered by the user each time the system is used or can be stored in the KB
Recommendation Systems • Examples of rules • If student only speaks English then MSc course must be in English • If topic of final year project is AI then student likes AI • If student likes AI and has grade > 7 in AI course and has passed Algorithms & Data Structures then MSc course title should contain word AI • If MSc course title should contain word AI and MSc course must be in English then MSc course in Edinburgh or MSc course in Imperial
Recommendation Systems • Implement a simple inference mechanism (or use Prolog’s) • Deliverables are same as previous assignments • Except the parts about semantic (frames networks) • This assignment is for 2 students
Recommendation Systems • Implementation of a simple system that will propose to a final year student potential job opportunities • Similar as Assignment 5 • Instead of MSc courses we have jobs • All else similar
Configuration • Implementation of a simple system that will construct PC configurations for clients • A client should be able to enter his/hers preferences • Cpu, RAM, HD, etc. • Assume that clients are not knowledgeable And the system should be able to construct a PC configuration that fits the client’s needs and satisfies any relevant constraints
Configuration • Design and implement a PC configuration rule-based system • Create a rule base using either • A pseudo formal language (define syntax) • Prolog • Implement a simple inference mechanism (or use Prolog’s)
Recommendation Systems • Examples of rules related to preferences • If wants fast PC and low cost then 2MHz <Cpu<3MHz and 2Gb<RAM<1Gb • If wants to play games then graphics controller is X or Y or Z • If wants fast internet then provide ADSL • Examples of rules related to constraints • If graphics controller is Y then sound controller is W • If wants HP PC then cost>1500
Configuration • Deliverables are same as previous assignments • Instead of rules you can use constraint satisfaction if you want • This assignment is for 2 students