Lectures on Artificial Intelligence – CS364 Knowledge Engineering

Download Report

Transcript Lectures on Artificial Intelligence – CS364 Knowledge Engineering

Artificial Intelligence – CS364
Knowledge Engineering
Lectures on Artificial Intelligence – CS364
Knowledge Engineering
08th November 2005
Dr Bogdan L. Vrusias
[email protected]
Artificial Intelligence – CS364
Knowledge Engineering
Contents
•
•
•
Definitions
Basic Process of Knowledge Engineering
Case Studies
08th November 2005
Bogdan L. Vrusias © 2005
2
Artificial Intelligence – CS364
Knowledge Engineering
Definition
• Davis’ law: “For every tool there is a task perfectly suited
to it”.
But…
• It would be too optimistic to assume that for every task
there is a tool perfectly suited to it.
• The process of building intelligent knowledge-based
systems is called knowledge engineering.
08th November 2005
Bogdan L. Vrusias © 2005
3
Artificial Intelligence – CS364
Knowledge Engineering
Process of Knowledge Engineering
Phase 1: Problem assessment
Phase 2: Data and knowledge acquisition
Phase 3: Development of a prototype system
Phase 4: Development of a complete system
Phase 5: Evaluation and revision of the system
Phase 6: Integration and maintenance of the system
08th November 2005
Bogdan L. Vrusias © 2005
4
Artificial Intelligence – CS364
Knowledge Engineering
Phase 1: Problem assessment
• Determine the problem’s characteristics.
• Identify the main participants in the project.
• Specify the project’s objectives.
• Determine the resources needed for building the system.
08th November 2005
Bogdan L. Vrusias © 2005
5
Artificial Intelligence – CS364
Knowledge Engineering
Phase 1: Problem assessment
Problem type
Description
Diagnosis
Inferring malfunctions of an object from its behaviour and
recommending solutions.
Selection
Recommending the best option from a list of possible
alternatives.
Prediction
Predicting the future behaviour of an object from its
behaviour in the past.
Classification
Assigning an object to one of the defined classes.
Clustering
Dividing a heterogeneous group of objects into
homogeneous subgroups.
Optimisation
Improving the quality of solutions until an optimal one is
found.
Control
Governing the behaviour of an object to meet specified
requirements in real-time.
08th November 2005
Bogdan L. Vrusias © 2005
6
Artificial Intelligence – CS364
Knowledge Engineering
Phase 2: Data and Knowledge Acquisition
• Collect and analyse data and knowledge.
• Make key concepts of the system design more explicit.
• Deal with issue of:
– Incompatible data
– Inconsistent data
– Missing data
08th November 2005
Bogdan L. Vrusias © 2005
7
Artificial Intelligence – CS364
Knowledge Engineering
Phase 3: Development of a Prototype System
• Choose a tool for building an intelligent system.
• Transform data and represent knowledge.
• Design and implement a prototype system.
• Test the prototype with test cases.
08th November 2005
Bogdan L. Vrusias © 2005
8
Artificial Intelligence – CS364
Knowledge Engineering
What is a prototype?
• A prototype system is defined as a small version of the
final system.
• It is designed to test how well we understand the problem
– to make sure that the problem-solving strategy, the tool
selected for building a system, and techniques for
representing acquired data and knowledge are adequate to
the task.
• It also provides us with an opportunity to persuade the
sceptics and, in many cases, to actively engage the domain
expert in the system’s development.
08th November 2005
Bogdan L. Vrusias © 2005
9
Artificial Intelligence – CS364
Knowledge Engineering
What is a test case?
• A test case is a problem successfully solved in the past for
which input data and an output solution are known.
• During testing, the system is presented with the same input
data and its solution is compared with the original solution.
08th November 2005
Bogdan L. Vrusias © 2005
10
Artificial Intelligence – CS364
Knowledge Engineering
Phase 4: Development of a Complete System
• Prepare a detailed design for a full-scale system.
• Collect additional data and knowledge.
• Develop the user interface.
• Implement the complete system.
08th November 2005
Bogdan L. Vrusias © 2005
11
Artificial Intelligence – CS364
Knowledge Engineering
Phase 5: Evaluation and Revision of the System
• Evaluate the system against the performance criteria.
• Revise the system as necessary.
• To evaluate an intelligent system is , in fact, to assure that the system
performs the intended task to the user’s satisfaction.
• A formal evaluation of the system is normally accomplished with the
test cases.
• The system’s performance is compared against the performance
criteria that were agreed upon at the end of the prototyping phase.
08th November 2005
Bogdan L. Vrusias © 2005
12
Artificial Intelligence – CS364
Knowledge Engineering
Phase 6: Integration and Maintenance
• Make arrangements for technology transfer.
• Establish an effective maintenance program.
08th November 2005
Bogdan L. Vrusias © 2005
13
Artificial Intelligence – CS364
Knowledge Engineering
Will an Expert System Work for my Problem?
• The Phone Call Rule:
“Any problem that can be solved by your in-house expert
in a 10-30 minute phone call can be developed as an expert
system”.
08th November 2005
Bogdan L. Vrusias © 2005
14
Artificial Intelligence – CS364
Knowledge Engineering
Case Study 1: Diagnostic Expert System
• Diagnostic expert systems are relatively easy to develop:
• Most diagnostic problems have a finite list of possible
solutions,
• Involve a rather limited amount of well-formalised
knowledge, and
• Often take a human expert a short time (say, an hour) to
solve.
08th November 2005
Bogdan L. Vrusias © 2005
15
Artificial Intelligence – CS364
Knowledge Engineering
Case Study 1: Diagnostic Expert System
08th November 2005
Bogdan L. Vrusias © 2005
16
Artificial Intelligence – CS364
Knowledge Engineering
Choosing an Expert System Development Tool
• Tools range from high-level programming languages such
as LISP, PROLOG, OPS, C and Java, to expert system
shells.
• High-level programming languages offer a greater
flexibility, but they require high-level programming skills.
• Shells provide us with the built-in inference engine,
explanation facilities and the user interface. We do not
need any programming skills to use a shell – we enter rules
in English in the shell’s knowledge base.
08th November 2005
Bogdan L. Vrusias © 2005
17
Artificial Intelligence – CS364
Knowledge Engineering
Choosing an Expert System Shell
• When selecting an expert system shell, we consider:
– how the shell represents knowledge (rules or frames);
– what inference mechanism it uses (forward or backward chaining);
– whether the shell supports inexact reasoning and if so what
technique it uses (Bayesian reasoning, certainty factors or fuzzy
logic);
– whether the shell has an “open” architecture allowing access to
external data files and programs;
– how the user will interact with the expert system (graphical user
interface, hypertext).
08th November 2005
Bogdan L. Vrusias © 2005
18
Artificial Intelligence – CS364
Knowledge Engineering
Case study 2: Classification Expert System
• Classification problems can be handled well by both expert
systems and neural networks.
• As an example, we will build an expert system to identify
different classes of sail boats. We start with collecting
some information about mast structures and sail plans of
different sailing vessels. Each boat can be uniquely
identified by its sail plans.
08th November 2005
Bogdan L. Vrusias © 2005
19
Artificial Intelligence – CS364
Knowledge Engineering
Case study 2: Classification Expert System
Jib-headed Cutter
Gaff-headed Sloop
Staysail Schooner Gaff-headed Schooner
Jib-headed Yawl
Gaff-headed Yawl
Jib-headed Ketch
08th November 2005
Bogdan L. Vrusias © 2005
Gaff-headed Ketch
20
Artificial Intelligence – CS364
Knowledge Engineering
Case study 2: Classification Expert System
/* Sailing Vessel Classification Expert System: Mark 1
Rule: 1 if
‘the number of masts’ is one
and ‘the shape of the mainsail’ is triangular
then boat is ‘Jib-headed Cutter’
Rule: 2 if
‘the number of masts’ is one
and ‘the shape of the mainsail’ is quadrilateral
then boat is ‘Gaff-headed Sloop’
Rule: 3 if
and
and
and
then
‘the number of masts’ is two
‘the main mast position’ is ‘forward of the short mast’
‘the short mast position’ is ‘forward of the helm’
‘the shape of the mainsail’ is triangular
boat is ‘Jib-headed Ketch’
Rule: 4 if
and
and
and
then
‘the number of masts’ is two
‘the main mast position’ is ‘forward of the short mast’
‘the short mast position’ is ‘forward of the helm’
‘the shape of the mainsail’ is quadrilateral
boat is ‘Gaff-headed Ketch’
08th November 2005
Bogdan L. Vrusias © 2005
21
Artificial Intelligence – CS364
Knowledge Engineering
Classification and Certainty Factors
• Although solving real-world classification problems often
involves inexact and incomplete data, we still can use the
expert system approach.
• However, we need to deal with uncertainties. The certainty
factors theory can manage incrementally acquired
evidence, as well as information with different degrees of
belief.
08th November 2005
Bogdan L. Vrusias © 2005
22
Artificial Intelligence – CS364
Knowledge Engineering
Classification and Certainty Factors
Rule: 1
Rule: 2
Rule: 3
Rule: 4
/* Sailing Vessel Classification Expert System: Mark 2
control cf
‘the number of masts’ is one
if
{cf 0.4};
then boat is ‘Jib-headed Cutter’
{cf 0.4}
boat is ‘Gaff-headed Sloop’
‘the number of masts’ is one
if
‘the shape of the mainsail’ is triangular
and
{cf 1.0}
then boat is ‘Jib-headed Cutter’
‘the number of masts’ is one
if
‘the shape of the mainsail’ is quadrilateral
and
{cf 1.0}
then boat is ‘Gaff-headed Sloop’
‘the number of masts’ is two
if
{cf 0.1};
then boat is ‘Jib-headed Ketch’
{cf 0.1};
boat is ‘Gaff-headed Ketch’
{cf 0.1};
boat is ‘Jib-headed Yawl’
{cf 0.1};
boat is ‘Gaff-headed Yawl’
{cf 0.1};
boat is ‘Gaff-headed Schooner’
{cf 0.1}
boat is ‘Staysail Schooner’
08th November 2005
Bogdan L. Vrusias © 2005
23
Artificial Intelligence – CS364
Knowledge Engineering
Will a Fuzzy Expert System Work for my
Problem?
• If you cannot define a set of exact rules for each possible
situation, then use fuzzy logic.
• While certainty factors and Bayesian probabilities are
concerned with the imprecision associated with the
outcome of a well-defined event, fuzzy logic concentrates
on the imprecision of the event itself.
• Inherently imprecise properties of the problem make it a
good candidate for fuzzy technology.
08th November 2005
Bogdan L. Vrusias © 2005
24
Artificial Intelligence – CS364
Knowledge Engineering
Case study 3: Decision-support Fuzzy Systems
• Although, most fuzzy technology applications are still
reported in control and engineering, an even larger
potential exists in business and finance. Decisions in these
areas are often based on human intuition, common sense
and experience, rather than on the availability and
precision of data.
• Fuzzy technology provides us with a means of coping with
the “soft criteria” and “fuzzy data” that are often used in
business and finance.
08th November 2005
Bogdan L. Vrusias © 2005
25
Artificial Intelligence – CS364
Knowledge Engineering
Case study 3: Decision-support Fuzzy Systems
• Mortgage application assessment is a typical problem to
which decision-support fuzzy systems can be successfully
applied.
• Assessment of a mortgage application is normally based on
evaluating the market value and location of the house, the
applicant’s assets and income, and the repayment plan,
which is decided by the applicant’s income and bank’s
interest charges.
08th November 2005
Bogdan L. Vrusias © 2005
26
Artificial Intelligence – CS364
Knowledge Engineering
Case study 3: Decision-support Fuzzy Systems
Market value
Location
Asset
Rule Base 1: Home Evaluation
House
Income
Rule Base 2: Applicant Evaluation
Interest
Income
Applicant
Rule Base 3: Credit Evaluation
Credit
08th November 2005
Bogdan L. Vrusias © 2005
27
Artificial Intelligence – CS364
Knowledge Engineering
Will a Neural Network Work for my Problem?
• Neural networks represent a class of very powerful,
general-purpose tools that have been successfully applied
to prediction, classification and clustering problems.
• They are used in a variety of areas, from speech and
character recognition to detecting fraudulent transactions,
from medical diagnosis of heart attacks to process control
and robotics, from predicting foreign exchange rates to
detecting and identifying radar targets.
08th November 2005
Bogdan L. Vrusias © 2005
28
Artificial Intelligence – CS364
Knowledge Engineering
Case study 4: Character Recognition Neural
Networks
• Recognition of both printed and handwritten characters is a
typical domain where neural networks have been
successfully applied.
• Optical character recognition systems were among the first
commercial applications of neural networks.
08th November 2005
Bogdan L. Vrusias © 2005
29
Artificial Intelligence – CS364
Knowledge Engineering
Case study 4: Character Recognition Neural
Networks
1
2
3
4
6
7
8
9 10
5
11 12 13 14 15
16 17 18 19 20
21 22 23 24 25
26 27 28 29 30
31 32 33 34 35
36 37 38 39 40
41 42 43 44 45
08th November 2005
Bogdan L. Vrusias © 2005
30
Artificial Intelligence – CS364
Knowledge Engineering
Case study 5: Prediction Neural Networks
• As an example, we consider a problem of predicting the
market value of a given house based on the knowledge of
the sales prices of similar houses.
• In this problem, the inputs (the house location, living area,
number of bedrooms, number of bathrooms, land size, type
of heating system, etc.) are well-defined, and even
standardised for sharing the housing market information
between different real estate agencies.
• The output is also well-defined – we know what we are
trying to predict.
• The features of recently sold houses and their sales prices
are examples, which we use for training the neural
network.
08th November 2005
Bogdan L. Vrusias © 2005
31
Artificial Intelligence – CS364
Knowledge Engineering
Case study 5: Prediction Neural Networks
Location rating
House condition
Number of bedrooms
Number of bathrooms
Living area
Land size
Garage
7
8
3
1
121.00 m2
682.00 m2
double
Type of heating system wood heater
08th November 2005
0.7000
0.8000
0.7500
0.5000
0.3550
0.4682
1.0000
1.0000
0.0000
0.0000
1
2
3
4
5
6
0.3546
$120,920
7
8
9
10
Bogdan L. Vrusias © 2005
32
Artificial Intelligence – CS364
Knowledge Engineering
Validating the Results
• To validate results, we use a set of examples never seen by
the network.
• Before training, all the available data are randomly divided
into a training set and a test set.
• Once the training phase is complete, the network’s ability
to generalise is tested against examples of the test set.
08th November 2005
Bogdan L. Vrusias © 2005
33
Artificial Intelligence – CS364
Knowledge Engineering
Case study 6: Classification Neural Networks
with Competitive Learning
• As an example, we will consider an iris plant classification
problem.
• Suppose, we are given a data set with several variables but
we have no idea how to separate it into different classes
because we cannot find any unique or distinctive features
in the data.
08th November 2005
Bogdan L. Vrusias © 2005
34
Artificial Intelligence – CS364
Knowledge Engineering
Case study 6: Classification Neural Networks
with Competitive Learning
• Neural networks can discover significant features in input
patterns and learn how to separate input data into different
classes. A neural network with competitive learning is a
suitable tool to accomplish this task.
• The competitive learning rule enables a single-layer neural
network to combine similar input data into groups or
clusters.
• This process is called clustering. Each cluster is
represented by a single output.
08th November 2005
Bogdan L. Vrusias © 2005
35
Artificial Intelligence – CS364
Knowledge Engineering
Case study 6: Classification Neural Networks
with Competitive Learning
• For this case study, we will use a data set of 150 elements
that contains three classes of iris plants – setosa, versicolor
and virginica.
• Each plant in the data set is represented by four variables:
sepal length, sepal width, petal length and petal width. The
sepal length ranges between 4.3 and 7.9 cm, sepal width
between 2.0 and 4.4 cm, petal length between 1.0 and 6.9
cm, and petal width between 0.1 and 2.5 cm.
08th November 2005
Bogdan L. Vrusias © 2005
36
Artificial Intelligence – CS364
Knowledge Engineering
Case study 6: Classification Neural Networks
with Competitive Learning
08th November 2005
Bogdan L. Vrusias © 2005
37
Artificial Intelligence – CS364
Knowledge Engineering
Case study 6: Classification Neural Networks
with Competitive Learning
• The next step is to generate training and test sets from the
available data. The 150-element Iris data is randomly
divided into a training set of 100 elements and a test set of
50 elements.
• Now we can train the competitive neural network to divide
input vectors into three classes.
08th November 2005
Bogdan L. Vrusias © 2005
38
Artificial Intelligence – CS364
Knowledge Engineering
Case study 6: Classification Neural Networks
with Competitive Learning
08th November 2005
Bogdan L. Vrusias © 2005
39
Artificial Intelligence – CS364
Knowledge Engineering
Closing
•
•
•
•
Questions???
Remarks???
Comments!!!
Evaluation!
08th November 2005
Bogdan L. Vrusias © 2005
40