Sunday, August 06, 2006

Rapid Prototyping using Prolog

In this lecture, we did an example and made an expert system called Car Diagnosis system. Knowledge base is comprised of three main parts i.e. Questions, Rules and Replies.
In this expert system, we first designed questions then rules and then tested the system based on different questions.
This lecture helped us alot in doing our final lab.

Thursday, August 03, 2006

Listing and Operations in Prolog

Last weeks lecture was on Listing and Operations in prolog. Listing is an ordered sequence of elements that can have any length. A list has two parts; a head and a tail. Elements can be alphabates, numeric values or combination of them can also be used. Since list has a different form of declaring itself, that's why list elements are enclosed in square brackets. Head and Tail, both can have more than one element. Empty list is represented as "[]" not [0] becase 0 is a character.
After an introdction to Listing in Prolog we did quite a few examples on list like; writing, reading, testing, reversin, finding any element in list, counting total number of elements in a list, concatinating two lists etc. Examples gave us an insight in listing because we practice them and we can have better idea on how list works.

The second part of today's lecture was about Operations in Prolog. Operators are special identifiers equivalent to predicates, which can be positioned in the program code in a specified way. Operators help in increasing the readability of the program. Operators can be of three type; a postfix operator, prefix operator and infix operator. All three are used in different positions and they work in different ways.
Postfix operator comes after element.
Prefix operator comes before element.
infix operator comes within two elements.

Monday, July 24, 2006

Recursion and Memory Management

Today's morning lecture was about Recursion. Recursion bascially means repetition of certain task. In other programing languages it is knows as Loop, but in prolog it is known as Recursion. Recursion is carried out until the answer is met. It does not have huge code, just a single line but it will keep on repeating itself till the answer is found. Recursion can help in saving time because you do not need to type in full code, just type a recuriosn rule and that's it.

Lab lecture was related to memory management in prolog. Recursion as it involves rules calling themselves, uses the stack heavily in this way, and it is possible in large programs for it to become overloaded, causing a program to crash or stop the computer. That's why memory management becomes an imporatnt issue in prolog. In Prolog there is a built in predicate called CUT. Since Prolog is sequentional, means it searches records in the database sequentially, thus causing loads of memory to be used if the program is huge. So it is very important for the programmer to use CUT predicate inorder to make efficient use of memory. CUT is a mechanism to enable the programmer to control the execution of programs. In prolog CUT is represented by an exclamation mark (!).

Backtracking

In today's lecture we studied about backtracking. Backtracking is a methodical way of trying out various sequences of decisions, until you find that works. Backtracking is basically searching in the databse, when prolog carries out search to do any any particular task, it basically is doing backtracking. Each and every condition of code is checked until the right one is found out. Backtracking gave us an idea that how prolog carries out the search inside the database...the good thing about backtracking in prolog is that it is buil into prolog, as a user you do not need to write down the code inorder to carry out your search.

Fail predicate is used in prolog inorder to force backtracking. The fail predicate forces prolog to carry our search even if the answer of query is found in the database.

Thursday, July 13, 2006

TMES

Toy medical expert system is build to diagnose three different diseases: Cold, Flu and Brain Tumour. There are three differnet versions of the expert systm. Each of them has its advantage and disadvantages.

Version-1
In Version-1 rules have been defined and user has been allowed to enter any symptom. The major disadvantage with this version is; if any symptom entered by the user and that is found in more than one disease, then this version will list down the names of all those diseases. For example, if we type in headache, it will list down cold and brain tumour.
Another drawback of this version is, if user enters diagnose(X). and press enter it shows only two diseases Cold and Brain_tumour.

Version-2
Version-2 successfully handles three different queries very well and list down them propery, by propely I mean it does not have the disadvantage which version-1 has. Vesion-2 asks user to type in the symptom name, then it searches the syptom along with the disease name and at the end shows the name of the disease. A small disadvantage with this version is, if user enters any sypmtom which is not found in the databse, it will not come up with any result becasue it hasnt found anything similiar in the database.

Version-3
Like Version-2 Version-3 handles all the queries very well, the disadvantages of version-2 have been overcome in this version of TMES>. Slight modification has been made in this version, when it will comeup with any disease name, it will also show the rule number which was used and if user enters any symptom which is not found against any disease, itw ill simply reply "Not Known" because it does not find the symptom in the databse.

Thursday, July 06, 2006

Fifth Week

Today we didnt have any lecture but today's class was quite a learning phase for students, In today's class, we did Lab-2 and marked Lab-1. The main aim of Lab-2 was to make student familiar with putting differnt records into prolog database and making use of different queries in prolog.
We did two important tasks from Lab-2; Planet database and Animal database. The queries involved in these two databases were about listing records from database using combination of different attributes.

Overall this lecture was quite helpful.

Monday, June 26, 2006

Fourth Week (Lab)

During Lab we did a couple of examples related to Lab-2 work, Dr Sri explained some examples and then we did remaining on our own. The lab also gave an insight on using prolog to save and edit files using notepad.

Fourth Week

Today's lecture was about an important phase in the development phase of expert system i.e. Knowledge Representation.
Knowledge representation is graphical representation of facts and data. Its actually a framework for storing and manipulating knowledge. There are different schemes that are used to represent knowledge like, Logical Scheme, Network Scheme, Procedural Scheme, Structural Scheme and Human Model. The scheme we are going to use is Semantic Scheme. Semantic Scheme uses semantic network to represent knowledge, it is comprised of nodes and arc.

Then we studied Rules and Facts in Procedural Scheme. These are formalization often used to specify recommendations, give directives or strategy.

Semantic Network will be helpful in making our Coursewrk because this will be used to represent the knowledge graphically. It is better to represent something in picture format than text because it gives the message more clearly and in less time.

Saturday, June 10, 2006

Second week (Lab)

Prolog is a language of Artificial Intelligence and it is a logic programming language. The name prolog came from Programming and Logic. Prolog is not like traditional programming languages, it is quite different. The programs are designed according to the priciples of logical problem solving. The problems are approached from the point of view of the data rather than procedure.

Programming in Prolog is usually very shorter than programming in other languages because there are no type declarations, no Go To statements, No Iterations etc.

Prolog seems to be very interesting because it tries to work like human mind. Dr Sri gave us quite a few example in order to get our hands in to the language. The example were very basic but they explained some basic Rules and Priciples of Prolog.
In 12 weeks time I'll try my best to become very good programmer in Prolog and will do my best to make a very good expert system.

Second Week

The topic under consideration in second week was Expert System. Expert System is a branch of Artificial Intelligence, it is an intelligent computer program that is used to solve complex problems which are not easy to solve trough human mind but they still lack in the robustness and general intelligence because of their narrowness.
Problems are mainly ill-defined and ill-structured. It focuses on one special area and acquires detailed knowledge about it which is used later to solve problems. From four different types of knowledge (Declarative, Strategic, Tacit, Procedural) it uses Declarative Knowledge.
In Declarative knowledge it uses only three main forms that are rules, facts and network of facts. The Expert system that is build from these is called Rule based system.

Every system has to go through some stages inorder to get a finished application/system. The SDLC stages of Expert system are comprised of;
Planning Knowledge Based
Organising Knowledge
Elicitation
Formulation Knowledge
Implementation
Testing, verification and validation.

Testing, verification and validation are one of the most important part of developing any system because they verify and validate that either we are building the right product and Product right, so it is very important to verify each and every stage of SDLC.

Expert systems can provide benefits to any organization if they are properly implemented and their limitations are well observed.