Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 30

Lecture : 7

Knowledge Representation Using Rules


There are common methodologies for the representation of
knowledge such as: production rules , semantic networks, and
frames .The production rules are sometimes called (IF THEN),
rules. (IF condition THEN action) ,and it is one of the most
common ways of representation knowledge .
Advantages of production rules:
1-It's modular (standard)
2-Every rule defines a small and independent space of
knowledge .((‫ك لق انونی ع رفحیز ص غیر ومستقلمنا لمع رفة‬
3- Enable adding new rules or deleting old ones.
4-The rules produced are usually independent of any other
rules.‫ا لقواعد ا لمنتجة عادة ما ت كونمستقلة عنأيق واعد أخرى‬.
Types of Rules:
There are three types of rules that are widely used in
production rules systems :
1- Knowledge Declarative Rules ‫ ق وانینا لمع رفة ا لتصریحية‬:
These rules set out all the facts and relationships of the
problem .
Example : IF inflation rate declines THEN the price of gold
goes down .
.‫ فإن سعر الذهب سیقل‬،‫إذا انخفضت نسبة التضخم‬
2- Inference Procedural Rules : ‫ق وانینا الستدال ال إِل جرائیة‬
Used to solve problems that we know some facts about
them .
For example: IF the data needed is not in the system,
THEN request it from the user .
3- Meta Rules‫ ق وانینا لقوانين‬:
These rules give explanations as to which rules should be
taken into account in order to begging the inference .
Expert systems: ( Definition and concept)
Is a software that imitates the behavior of the human expert in
a particular field by extraction, compiling, analyzing and
reusing the information and experience of that expert in the
field and include them into a system called the expert system.
So that these systems can processing problems in this area
rather than people with experience and help transfer these
experiences to other people.
‫ه ي برمجيات تقوم بتقليد س لوك اإلنس ان الخ بير ف ي مجال معين وذل ك ع ن طريق‬
‫اس تخالص وتجميع وتحليل وإعادة اس تخدام معلومات وخ برة ذل ك الخ بير ف ي المجال‬
‫ بحيث يصبح بإمكان هذه النظم معالجة المشاكل في‬.‫وضمها في نظام يُدعى النظام الخبير‬
‫هذا المجال بدالً م ن األشخاص أص حاب الخ برة والمس اعدة ف ي نق ل هذه الخ برات ألناس‬
.‫آخرين‬
It is also: an intensive knowledge program that works to
treating the difficult problems that are treated only by
human experts (such as medical diagnosis).
‫وهي ايضا برامج للمعرفة المكثفة تعمل على عالج المشاكل الصعبة التي ال تعالج إال‬
.)‫من قبل الخبراء من البشر ( مثل التشخيص الطبي‬
Expert systems are characterized as the domain in which
knowledge is represented and search is controlled within
knowledge bases.
‫وتتميز النظم الخبيرة بأنها المجال الذي يتم فيه تمثيل المعرفة ويتم التحكم في البحث‬
. ‫ضمن قواعد المعرفة‬
Expert system concept :
Is a computer program designed to modeling human
experience in problems solving .
. ‫هو برنامج كمبيوتر مصمم لنمذجة خبرات اإلنسان في حل المشكالت‬
Expert Systems Classifications
:Knowledge can generally be classified into two categories
Public knowledge)1(
Private knowledge)2(
(1) Public knowledge
Means the knowledge that available in books, and the
media ...etc, and can be obtained through reading,
presentation, conclusion and others.
‫ ويمك ن الحص ول‬، ‫الخ‬... ‫يقص د به ا المعرف ة المتاح ة ف ي الكت ب ووس ائل اإلعالم‬
. ‫ واالستنتاج وغيرها‬،‫ والعرض‬،‫عليها من خالل القراءة‬
(2) Private knowledge
It is the accumulated knowledge of the expert through his
long experience in his field, which is often exclusive and does
not find its way to publication.
Private knowledge is the basis upon which the expert relies on
any decision or advice.
،‫هي المعرفة المتراكمة لدى الخبير من خالل خبرته الطويلة في مجال عمله‬
‫ المعرفة الخاصة هي األساس الذي‬.‫والتي غالبا ما تكون حصرية وال تجد طريقها للنشر‬
‫يعتمد عليه الخبير عند اتخاذ أي قرار أو تقديم المشورة‬.
Expert systems components:
.:Consists of two parts
:First Tranche
In which the knowledge base is constructed in the following
:sequence
.: ‫يتكون من شقين‬
: ‫الشق األول‬
.‫والذي يتم فيه بناء قاعدة المعرفة وذلك بالتسلسل التالي‬
The Expert -1
Or a group of experts in the specific field whose expertise
system is required, giving all the experiences they have collect
it to the knowledge engineer
‫ حيث‬، ‫أو مجموعة الخبراء في المجال المعين المطلوب الحصول على نظام الخبرة فيه‬
‫يقوم بإعطاء كل ما جمعوه من خبرة بأدق التفاصيل إلى مهندس المعرفة‬
2-Knowledge Engineer
Which sets the experience in the form of rules for
conditional inclusion including the conditions and results
of these conditions as well as the application of different
techniques.
‫والذي يتول ى وض ع الخ برة ف ي شك ل قواع د للتضمي ن الشرط ي متضمن ة للشروط‬
. ‫والنتائج لهذه الشروط وكذلك تطبيق التقنيات المختلفة‬
Second Tranche :
In which questions are asked by the user and obtained results
or advice from the expert system which is in the following
sequence :
:‫الشق الثاني‬
‫والذي يت م فيه طرح األس ئلة م ن قب ل المس تخدم والحص ول عل ى النتائ ج أ و النص يحة م ن‬
: ‫النظام الخبير والذي يتم بالتسلسل التالي‬
(1)The User
Inexperienced or limited experience who wants to get the real
knowledge and experience gained for a problem in this area.
‫العديم الخبرة أو ذو الخبرة المحدودة والذي يريد أن يحصل على المعرفة الحقيقية والخبرة‬
.‫المكتسبة لمشكلة ما في هذا المجال‬
(2)User interface : ‫واجهة ا لمستخدم )) مدخلا لمواءمة ل لمستخدم‬
Which allows the exchange of knowledge between the user
and the knowledge base, it makes the user's questions
understandable by the knowledge base.
‫والذي يسمح بتبادل المعرفة بين المستخدم وقاعدة المعرفة و يجعل اسئلة المستخدم‬
. ‫مفهومة من قبل قاعدة المعرفة‬
(3)Control Mechanism
It is the internal control of the inference engine and
knowledge base to answer the questions asked by the user.
‫وهي التي تقوم بالتحكم الداخلي في محرك االستدالل وقاعدة المعرفة لإلجابة على‬
. ‫االسئلة المطلوبة من قبل المستخدم‬
(4)Knowledge base:
Is a database that includes the knowledge and expertise of
experts in a field of human knowledge stored in a logical
sequence to implement the condition (if then), knowledge
base includes: facts, rules that show the relationships between
the facts, Knowledge base is flexible and can be updated
without affecting the work of other components
: ‫قاعدة المعرفة‬-
‫ه ي قاعدة بيانات تشتم ل عل ى معارف وخ برات الخ براء ف ي مجال م ن مجاالت المعرف ة‬
‫ وتض م‬، )‫ عندئ ذ‬---- ‫البشرية مختزن ة ف ي شك ل تس لسل منطق ي لتنفيذ الشرط (اذا كان‬
‫ وتتميز قاعدة المعرف ة‬، ‫ وقواع د ت بين العالقات بين الحقائ ق‬، ‫ حقائ ق‬: ‫قاعدة المعرف ة‬
. ‫بالمرونة حيث يمكن تحديثها دون المساس بعمل باقي المكونات‬
Inference Engine )5( : ‫آلة االستدالل‬
Which directs research into different trends in the
knowledge base until the user's questions is answered .
‫والتي تقوم بتوجيه البحث في االتجاهات المختلفة بقاعدة المعرفة إلى أن تتم اإلجابة‬
‫على اسئلة المستخدم‬
:The Inference is done in two ways
Forward Chaining-1
Backward Chaining-2
Forward Chaining )1(: ‫التسلسل االمامي‬
Where the system analyzes the data entered in it and when
the matching of conditions is achieved, the goal is
implemented .
‫حيث يقوم النظام بتحليل البيانات المدخلة اليه وعندما يصل الى تطابق الشروط يقوم‬
)‫بالتنفيذ (الوصول الى الهدف‬
Backward Chaining)2( : ‫التسلسل الخلفي‬
Here, the inference engine starts with the search from the
general goal to the lowest level of sub-goals .
‫هنا تبدأ آلة االستدالل بالبحث بداية من الهدف العام حتى ادنى مستوى من االهداف‬
‫الفرعية‬
Expert Systems Features: ‫ مميزاتا لنظم ا لخبيرة‬:
1. It is easy to use for any user, whether a regular user or a
developer.
2. Able to learn from experts directly and indirectly.
3. Able to teach non-specialists.
4 - Able to interpret any solutions you reach and clarify how to
access them.
5. A useful means of providing high levels of expertise in the
absence of an expert.
6. Able to develop the performance of specialists with simple
experience.
7. Preservation of human knowledge from loss, loss or
distortion Since the majority of knowledge is limited to a few
experts, their loss often results in a significant loss, and expert
systems are therefore a repository of this expertise.
‫‪ -1‬أنها سهلة االستخدام ألي مستخدم سواء مستخدم عادي أو مط ّور ‪.‬‬
‫‪ -2‬قادرة على التعلم من الخبراء بطريقة مباشرة وغير مباشرة ‪.‬‬
‫‪ -3‬قادرة على تعليم غير المتخصصين ‪.‬‬
‫‪ -4‬قادرة على تفسير أي حلول تتوصل إليها مع توضيح طريقة الوصول إليها ‪.‬‬
‫‪ -5‬وسيلة مفيدة في توفير مستويات عالية من الخبرة في حال عدم توفر خبير‪.‬‬
‫‪ -6‬قادرة على تطوير أداء المتخصصين ذوي الخبرة البسيطة‪.‬‬
‫‪ -7‬حفظ المعارف البشرية من الفقد أو الضياع أو التشوه آذ أن غالبية المعارف تكون‬
‫محصورة في قلة من الخبراء غالبا ما يؤدي فقدانهم إلى خسارة كبيرة‪ ،‬وعلى ذلك فان‬
‫النظم الخبيرة تعد مستودعا أمينا لهذه الخبرة‪.‬‬
: Disadvantages of Expert System
.Limited areas compared to human activity .1
High costs of design, operation and maintenance of the .2
.system
3. Desired knowledge may not always be available or
difficult to use.
4 - Method of solving the problem may be different from
one expert to another
1-‫ت لمحدودة مقارنة ب ا لنشاط ا لبشري‬
‫ا لمجا ال ا‬.
2- ‫ف صميم وتشغيلوصيانة ا لنظام‬
‫ارتفاع ت كا لي ت‬.
3- ‫ف لمنشودة ق د ال ت كونمتوافرة دائما أو يصعباستخدامها‬
‫ا لمع ار ا‬.
4- ‫منهج حلا لمشكلة ق د يختلفمنخبير إ لىأخر‬
Stages of building expert systems:
Stages of building expert systems
1.Definition of problem: The problem required by the
expert system is described in a precise description of the
cooperation between the knowledge engineer and the
expert domain .
‫ يتم وصف المشكلة المطلوب من النظام الخبير حلها وصفا دقيقا‬:‫التعريف بالمشكلة‬
.‫بالتعاون بين مهندس المعرفة وخبير المجال‬
2 - The formation of concepts.
.‫تكوين المفاهيم‬
3. Drafting: Knowledge engineers choose the appropriate
techniques to develop the system.
‫ يقوم مهندسي المعرفة باختيار التقنيات المناسبة لتطوير النظام‬:‫الصياغة‬
4. Application: Concepts that are formulated using the
computer are programmed.
.‫ يتم برمجة المفاهيم التي تمت صياغتها باستخدام الحاسب‬:‫التطبيق‬
5. Testing: The knowledge engineer tests the model in the
following ways:
-Application correct
:‫ يقوم مهندس المعرفة باختبار النموذج من النواحي التالية‬:‫االختبار‬
‫ صحة التطبيق‬
-The efficiency and completeness of drafting rules .
‫ كفاءة واكتمال صياغة القواعد‬
- The solutions it offers are matched by expert solutions in
the same field .
.‫ تتطابق الحلول التي يقدمها مع حلول خبير في نفس المجال‬
:Areas of expert systems
Expert systems have entered into several fields such as
medicine, agriculture, electronics, computers, geology,
engineering, education, law, trade, economics and many
more.
‫النظ م الخ بيرة دخل ت ف ي عدة مجاالت كالط ب والزراع ة واإللكترونيات والحاس بات‬
. ‫والجيولوجيا والهندسة والتعليم والقانون والتجارة واالقتصاد وغيرها الكثير‬
The following example illustrates a rule with introductions
and results:
IF
The car engine starts turning and the car does not move
And the battery is charged
And the Starter is good
THEN
The car is free of fuel (Petrol)
: ‫إذا كان‬
‫محرك السيارة يبدأ الدوران والسيارة ال تتحرك‬
‫و البطارية مشحونة‬
‫) جيد‬Starter( ‫و مبدئ الحركة‬
‫إذن فالسيارة خالية من الوقود‬
Example: How to build knowledge bases ?
Rule 1: If a burning substance is poured, it causes fire
Rule 2: If the chemical concentration of the substance is less
than 6, the substance is acidic.
Rule 3: If the substance is acidic and its smells like vinegar, it is
acetic acid.
Rule 4: If the substance is acetic acid it is a non-incendiary
material.
.‫ إذا سكبت مادة حارقة قد تسبب بالحريق‬:1‫قاعد‬
.‫ فان المادة تمثل حامضا‬6 ‫ إذا كان التركيز الكيمائي للمادة أقل من‬:2‫قاعدة‬
.‫ إذا كانت المادة المسكوبة حامضا ورائحتها مثل الخل فإنها حامض الخليك‬:3‫قاعدة‬
. ‫ إذا كانت المادة حامض الخليك فإنها مادة غير حارقة‬:4 ‫قاعدة‬
If one of them pours a substance, the following facts are
available:

Fact 1: Its chemical concentration is less than 6


.Fact 2: It smells like vinegar
:‫وإذا سكب احدهم مادة توفرت فيها الحقائق التالية‬

6‫ أن تركيزها الكيمائي أقل من‬:1‫حقيقة‬


.‫ أن رائحتها تشبه الخل‬:2‫حقيقة‬
When we compare the facts with the rules, we find a
correlation between fact 1 and rule 2, which results in a new
fact:
Fact 3: That the substance is acid.
‫ مع ا ينتج‬2 ‫ والقاعدة‬1 ‫فعن د مقارن ة الحقائ ق بالقواع د حي ث نج د مطابق ة بي ن الحقيق ة‬
:‫عن ذلك حقيقة جديدة هي‬
.‫ أن المادة هي حامض‬:3‫حقيقة‬
When the comparison process is reconciled we find a
correspondence between facts 2 and 3 and rule 2 together
produces a new fact:
‫ معا ينتج حقيقة‬2 ‫ والقاعدة‬3‫و‬2 ‫وعند إعادة عملية المقارنة نجد تطابقا بين الحقائق‬
: ‫جديدة‬
Thus we produce a new fifth fact:
Fact 5: The material is not incendiary
Therefore they do not cause fire
:‫وهكذا تنتج لدينا حقيقة خامسة جديدة هي‬
.‫ أن المادة ليست حارقة‬:5‫حقيقة‬
‫وبالتالي فهي ال تسبب الحريق‬

You might also like