400 likes | 554 Vues
Web Enabled Expert Systems using Hyperlink-based Inference. Yong U. Song: yusong@dragon.yonsei.ac.kr Wooju Kim: cosmos@mail.chonbuk.ac.kr June S. Hong: junehong@kyonggi.ac.kr. Agenda. Web-enable Expert Systems Basic Idea of Hyperlink-based Inference Performance Evaluation
E N D
Web Enabled Expert Systems using Hyperlink-based Inference Yong U. Song: yusong@dragon.yonsei.ac.kr Wooju Kim: cosmos@mail.chonbuk.ac.kr June S. Hong: junehong@kyonggi.ac.kr
Agenda • Web-enable Expert Systems • Basic Idea of Hyperlink-based Inference • Performance Evaluation • Converting Rule Base to FES • Hyperlink-based Inference • Automatic Generation and Management of Inference Sites by WeBIS • Summary
Web-enabled Expert Systems • 다양한 Intelligent Web-based Applications의 필요성 • 지능형 웹 사이트 • 개인화 웹 사이트 • 고객 서비스 • Call center, 금융 상담, … • 서버 부하의 문제 • Multi-processing • CGI(Common Gateway Interface) • FastCGI(Open Market), mod-perl(Apache Web Server), PerlEx(Active State) • Transaction server : MTS (ASP), … • Multi-threading : Java Servlet, JSP, … • Fact base • Connectionless & stateless • 질문화면마다 추론 재 수행 필요
If signal-light IS red THEN stop If signal-light IS green THEN go Basic Idea of Hyperlink-based Inference
Pros and Cons of Hyperlink-based Inference • 장점 • 기존 웹 환경에서 별도의 시스템 없이 구현 가능 • On-line & Off-line • 웹 서버의 부하 저감 • Multi-processing • Fact base • 단점 • 규칙의 일반성 • 규칙의 관리
Implementation Procedure of Hyperlink-based Inference 1. Prepare a rule base by acquiring domain knowledge. 2. Convert the rule base to an FES. • FES generation algorithm 3. Conduct hyperlink-based inference • Hyperlink-based inference 4. Maintain the inference site • Automatic generation and management of inference sites by WeBIS
(BWD-RULE 규칙1 IF (IS "동물이 털이 있다." TRUE) THEN (IS 포유류이다. TRUE)) (BWD-RULE 규칙2 IF (IS "동물이 젖이 있다." TRUE) THEN (IS 포유류이다. TRUE)) (BWD-RULE 규칙3 IF (IS "동물이 깃털이 있다." TRUE) THEN (IS 새이다. TRUE)) (BWD-RULE 규칙4 IF (IS "동물이 난다." TRUE) (IS "동물이 알을 낳는다." TRUE) THEN (IS 새이다. TRUE)) (BWD-RULE 규칙5 IF (IS 포유류이다. TRUE) (IS "고기를 먹는다." TRUE) THEN (IS 육식동물이다. TRUE)) (BWD-RULE 규칙6 IF (IS 포유류이다. TRUE) (IS "송곳니가 있다." TRUE) (IS "날카로운 발톱이 있다." TRUE) (IS "눈이 전방을 향해 있다." TRUE) THEN (IS 육식동물이다. TRUE)) (BWD-RULE 규칙7 IF (IS 포유류이다. TRUE) (IS "발굽이 있다." TRUE) (IS "되삭임질을 한다." TRUE) THEN (IS 초식동물이다. TRUE)) (BWD-RULE 규칙8 IF (IS 육식동물이다. TRUE) (IS 황갈색이다. TRUE) (IS "검은 점이 있다." TRUE) THEN (IS 치타이다. TRUE)) Preparing a Rule Base
FES Generation Algorithm (1) • Assumption • The rule base is based on the propositional logic. • P Q R S • It does NOT support the predicate calculus. • x S(x) D(x) • FES • Functionally Equivalent hyperlinked HTML page Set • A kind of decision graph • SNF • Simplified Normal Form • A canonical form in which every literal is connected by disjunction.
FES Generation Algorithm (2) • Generation Procedure Step 1) Eliminate chaining variables • Q R C, P C S P (Q R) S Step 2) Convert to SNF by De Morgan’s Law • P (Q R) (P Q) (P R) Step 3) Eliminate disjunction and split the rule • (P Q) (P R) S P Q S, P R S Step 4) Convert to FES • Note that literals in condition part of the rule are connected by conjunction. • See next pages.
FES Generation Algorithm (3) R1: a b c x R2: b d y x T y c T T F d b T F F ? ? y T a d T F F ? b F ?
* Notation R : a rule base, a finite set { ri, i = 1, …, n} ri : a rule, a pair (Pi, ci), where Pi is a finite set and ci is a term Pi : a finite set { pij, j = 1, …, mi }, of which elements are propositions and the propositions are connected by AND operators because we assume the rules are in canonical form ci : a conclusion T : a tree, a pair (V, E), where V is a finite set and E is a binary relation on V V : a vertex set of T, { vk, k = 1, …, p } vk : a vertex, a singular set (nk), of which element represent propositions or conclusions of rules, that is, nk = pij for some k, i, and j or nk = ci for some k and i E : an edge set of T, { es, s = 1, …, q } es : an edge, a set (vs1, vs2, bs, Fs), where vs1 and vs2 are two vertices connected by es, bs is a Boolean value(true or false), which represents whether the connection condition for proposition vs1 is true or false, and Fs is a finite set Hs : a path, a finite set of edges { est, where t = 1, …, rs }, of which elements are all the edges which connect the vertices from vs2 to the root vertex. Note that Hs includes es by definition. Fs : a fact base, a finite set of facts { fst = (nst1, bst), built from est = (vst1 = (nst1), vst2, bst, Fst) in Hs, t = 1, …, rs } fst : a fact, a pair (nst, bst), which represents that the value of nst is bst, where nst is a proposition, that is nst = pij for some s, t, i, and j, and bst is a Boolean value
function ConvertRulebase2Tree(R) returns T inputs: R = { ri, i = 1, …, n}, a rule base variables: T = (V, E), a binary tree NonconnectedEdges = { ej }, a set of edges ej = (v1, v2, b, F), an edge T.V T.E NonconnectedEdges for each riin R do NonconnectedEdges ConvertRule2Tree(NonconnectedEdges, ri, T) end for for each ejin NonconnectedEdges do make a conclusion c = “No conclusion” make a vertex v = (c) T.V T.V { v } ej.v2 v end for return T
function ConvertRule2Tree(NonconnectedEdges, r, T) returns Edges inputs: NonconnectedEdges = { es }, a set of edges ej = (vs1, vs2, bs, Fs), an edge r = (P, c), a rule P = { pj }, a set of propositions inputs & outputs: T = (V, E), a binary tree to be built variables: Edges = { es }, a set of edges es = (vs1, vs2, bs, Fs), an edge CurrentEdge = (v1, v2, b, F), an edge Edges if NonconnectedEdges = then CurrentEdge NULL for each pjin r.P do make a vertex v = (pj) T.V T.V { v } make a fact falseFact = (pj, false) make a fact trueFact = (pj, true) if CurrentEdge = NULL then make an edge falseEdge = (v, NULL, false, { falseFact }) make an edge trueEdge = (v, NULL, true, { trueFact }) else CurrentEdge.v2 v make an edge falseEdge = (v, NULL, false, CurrentEdge.F { falseFact }) make an edge trueEdge = (v, NULL, true, CurrentEdge.F { trueFact }) end if T.E T.E { trueEdge, falseEdge } Edges Edges { flaseEdge } CurrentEdge trueEdge end for make a vertex v = (r.c) T.V T.V { v } CurrentEdge.v2 v
else for each esin NonconnectedEdges do if Match(r.P, es.F) = false then Edges Edges { es } else CurrentEdge = es for each pjin r.P do if Exist(pj, CurrentEdge.F) = false then make a vertex v = (pj) T.V T.V { v } make a fact falseFact = (pj, false) make a fact trueFact = (pj, true) CurrentEdge.v2 v make an edge falseEdge = (v, NULL, false, CurrentEdge.F { falseFact }) make an edge trueEdge = (v, NULL, true, CurrentEdge.F { trueFact }) T.E T.E { trueEdge, falseEdge } Edges Edges { flaseEdge } CurrentEdge trueEdge end if end for make a vertex v = (r.c) T.V T.V { v } CurrentEdge.v2 v end if end for end if return Edges
function Match(P, F) returns Boolean inputs: P = { pj }, a set of propositions F = { ft = (nt, bt) }, a fact base for each pjin P do for each ftin F do if pj = ft.ntand ft.bt = false then return false end if end for end for return true function Exist(p, F) returns Boolean inputs: p, a proposition F = { ft = (nt, bt) }, a fact base for each ftin F do if p = ft.ntthen return true end if end for return false
Algorithm Extensions S • NOT operator • P S • Enumeration type IF (M = a) THEN S • Possible values of M: • a, b, c • Make multiple branches • Numerical expressions IF (a + b) > 3 AND p = TRUE THEN s IF p = FALSE AND (a + c) < 5 THEN t • Global Variables F P T ? S a M b ? c ? s T t p T T F c a,b F ? F ?
Hyperlink-based Inference • There are three categories of variables for conducting inference. • Boolean Type • Implemented by Hyperlink • Enumeration Type • Implemented by Hyperlink • Numeric Type • Implemented by the client-side script (JavaScript / VBScript)
Implementation of Numeric Type Variables IF total_income >= 0.2 * threshold THEN pay_tax
<HTML> <HEAD> <TITLE> Expression Type </TITLE> <SCRIPT LANGUAGE="JavaScript"> <!-- function verifyValue(form) { if (form.total_income.value >= 0.2 * form.threshold.value) { location="http://iis.kaist.ac.kr/paytax.html" } else { location="http://iis.kaist.ac.kr/notax.html" } } //--> </SCRIPT> </HEAD> <BODY> <FORM NAME="exprform"> <BR> 다음을 입력하십시오. <BR> total_income <INPUT TYPE="text" NAME="total_income"> <BR> threshold <INPUT TYPE="text" NAME="threshold"> <BR><BR> <INPUT TYPE="button" VALUE="OK" onClick="verifyValue(this.form)"> </FORM> </BODY> </HTML>
WeBIS* • It is a tool for automatic generation and management of inference sites • It represents the knowledge (FES) by Expert’s Diagram** • Note that there is one-to-one correspondence between FES and Expert’s Diagram. • It generates HTML documents, which are hyperlinked to each other, using HTML, JavaScript, ASP, WML, etc. depending on the implementation platform. • It supports the design of the sites by Template files. • It is able to analyze a Web site by generating Expert’s Diagram from the Web pages in the site. * http://www.waisolutions.com/ ** Lee, J. K., I. K. Lee, and H. R. Choi, "Automatic rule generation by the transformation of Expert's Diagram: LIFT," Int. J. Man-Machine Studies, 32(1990), 275-292.
Automatic Generation WeBIS HTML Docs. Manual Input by Knowledge Engineer Web site Analysis Automatic conversion Internet Rule base Knowledge Acquisition Web Browsers Web Servers Knowledge Source Architecture of WeBIS
Capacity of WeBIS • 지식분석도 입력 및 수정 • 디자인 지원 – Theme 및 Template 편집 • 추론 사이트 생성 • HTML(Client-side script) • ASP(Server-side script) • WML • Level of Abstraction • Grouping nodes • 웹 사이트 분석 • Database 연결 • Session 처리
Design Support and Template Files (2) <HTML> <HEAD> <TITLE> <!--WGITITLE--> </TITLE> <!--WGBRANCH--> </HEAD> <BODY> <TABLE ALIGN=CENTER> <!--WGINPUTFORM " 확 인 " 3--> </TABLE> <!--WGOBJECT photo--> </BODY> </HTML>
Design Support and Template Files (3) <HTML><HEAD> <TITLE> 허리에 통증? </TITLE> <SCRIPT LANGUAGE=JavaScript> function WBIBranch(form) { if (form.WBIName1[0].checked) { form.action = "WBI2.html"; } else if (form.WBIName1[1].checked) { form.action = "WBI3.html"; } else { } if (form.action != null && form.action != "") { form.submit(); } } </Script> </HEAD> <BODY> <TABLE ALIGN=CENTER> <FORM METHOD=GET NAME="WBIForm1"> <TR> <TD COLSPAN=1 width="223" height="35" bgcolor="#EBDF8F"><B>허리에 통증?</B></TD> </TR> <TR> <TD> <INPUT TYPE=RADIO NAME="WBIName1" VALUE="WBIValue1_0_0">Yes </TD> </TR> <TR> <TD> <INPUT TYPE=RADIO NAME="WBIName1" VALUE="WBIValue1_1_0">No </TD> </TR> <TR> <TD COLSPAN=1> <BR> </TD> </TR> <TR> <TD COLSPAN=1> <BR> </TD> </TR> <TR> <TD COLSPAN=1> <BR> </TD> </TR> <TR> <TD COLSPAN=1 ALIGN=CENTER> <INPUT TYPE=BUTTON VALUE=" 확 인" OnClick="WBIBranch(this.form)"> </TD> </TR> </FORM> </TABLE> </BODY> </HTML>
Application of WeBIS • Classification Problems • 진단, 자문, 신용평가 • 지식 기반 상품 추천 • 고객 안내 등 • Knowledge Management System • 지식 입력 및 관리 • Development and Maintenance of Web Sites • CASE Tool
Summary • We suggest a hyperlink-based inference mechanism and show that the mechanism can resolve the problem of heavy burden to Web servers during the inference. • We suggest a methodology for the implementation of Web-enable, hyperlink-based expert systems by devising the FES generation algorithm. • We developed a tool called WeBIS for the automatic generation and management of inference sites.