lab 1 intelligent information systems .pptx

asmaashalma456 24 views 17 slides Sep 21, 2024
Slide 1
Slide 1 of 17
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17

About This Presentation

Intelligent information system


Slide Content

Intelligent information systems “ lab1”

Expert Systems

How To Implement an expert system CLIPS Python

CLIPS   a rule‑based programming language Written in C  CLIPS is an abbreviation to the C Language Integrated Production System useful for creating expert systems and other programs where a heuristic solution is easier to implement and maintain than an algorithmic solution

Experta Pyknow Experta is a Python library for building expert systems strongly inspired by  CLIPS the goal of making it easy for the CLIPS programmer to transfer all of his/her knowledge to this platform.  Difference between CLIPS and Experta CLIPS is a programming language, Experta is a Python library. CLIPS is written in C, Experta in Python In CLIPS you add facts using  assert , in Python  we use  declare  instead 

Experta Installation To install Experta , run this command in your terminal : pip install experta Pip  python installer package

Facts Facts  are the basic unit of information of Experta . They are used by the system to reason about the problem. The class Fact is a subclass of dict. from experta import * f = Fact(a=1 , b=2 )

Facts In contrast to  dict , you can create a Fact without keys (only values), and Fact will create a numeric index for your values . f2 = Fact(' x','y','z ') You can mix autonumeric values with key-values, but autonumeric must be declared first : f3 = Fact(' x','y','z',a =1,b=2)

Facts You can subclass  Fact  to express different kinds of data or extend it with your custom functionality . class Alert(Fact): """The alert level.""" pass class Status(Fact): """The system status.""" pass f1 = Alert( 'red‘, ‘noise’) f2 = Status('critical')

Rules In Experta a rule is a callable, decorated with Rule . @Rule Rules have two components, LHS (left-hand-side) and RHS (right-hand-side). The LHS describes (using patterns) the conditions on which the rule should be executed (or fired). The RHS is the set of actions to perform when the rule is fired.

Rules @Rule(Fact('animal', family=' felinae ')) # This is the LHS def match_with_cats (): # This is the RHS """ Match with every `Fact` which: * f[0] == 'animal' * f['family'] == ' felinae ' """ print("Meow!")

Rules
Tags