This document provides an overview of using Prolog to implement decision trees through an application called Edusmart. It demonstrates basic "Hello World" programs in Prolog, shows how to represent a sample decision tree in XML, and how that XML can be translated into Prolog code to execute the decision tree. It concludes by asking if there are any opportunities to improve the Edusmart decision tree approach.
3. Quick Start I Hello World: q00(X00):- Â write('hello world'). save to classex1.pl execute with pl -s classex1.pl 1 ?- q00(X). hello world true.
4. Quick Start II q00(X00, R):- Â write('Are you under 13?'), read(INPUT), write('INPUT: '), write(INPUT). pl -s classex2.pl 1 ?- q00(X,R). Are you under 13?y. INPUT: y true.
5. Edusmart Purpose Url: Â http://www.graysonconsulting.biz/edusmart.swf Sourceforge url: Â http://sourceforge.net/projects/edusmart/ Architecture: flash rtmp -> python server -> swipl prolog
7. Example Decision Tree XML raw xml: <root> <node label="Are you under 13?, y/n"> Â Â <node label="y, Are your parents wealthy?, y/n"> Â Â Â <node label="y, You are lucky"/> Â Â Â <node label="n, Just get a loan"/> Â Â </node> </node> <node label="Are you over 13?, y/n"> Â Â <node label="y, You are passed the hardest year"/> </node> <node label="You are 13"/> </root>
8. Prolog from XML q00(X00, R):- Â write('Are you under 13?'), read(INPUT), write(''), q10(INPUT, R). q10(X10, R):- Â X10=y, write(' Are your parents wealthy?'), read(INPUT), write(''), q20(INPUT, R). q20(X20, R):- Â X20=y, write(' You are lucky'), !. q20(X20, R):- Â X20=n, write(' Just get a loan'), !. q00(X01, R):- Â write('Are you over 13?'), read(INPUT), write(''), q11(INPUT, R). q11(X11, R):- Â X11=y, write(' You are passed the hardest year'), !. q00(X02, R):- Â write('You are 13'), !.
9. Execution of Decision Tree pl -s brain2.pl 1 ?- q00(X,R). Are you under 13?n. Are you over 13?n. You are 13 true.
10. Conclusion Prolog is the best rule based engine in existence Other rule based implementations are not as clear Python has a very similar syntax to prolog Do you see any future opportunities for improvement of the edusmart decision tree approach?