Posts Tagged ‘PHP EXPERT SYSTEM’

AI Forward chaining

Tuesday, February 9th, 2010

In the last post I described a little about the backward chaining approach used in EarnestAI.  Today I wanted to say a bit about Forward Chaining.  Forward chaining is basically a lazy approach to finding an answer.  The system starts with a question to a known answer such as “Who created you?”

The system then presents a series of preset questions, for example “Do you mean who is my creator?”

The user answers Yes, and the system then moves onto the next question.  When all the questions are complete, the system then compares the answers against a set of stored solutions and decides which solution is best defined by the answers given.

Its a very accurate process in reality, but can also be confusing and irritating for the user.  The best example I have seen to demonstrate this is “Are you male?” Yes,  “Are you pregnant?”, No, “Are you female?”

You get the picture, the system has little or no understanding of the questions it poses, and the onus is on the knowledge engineer to devise the question structure so as to be as unconfusing as possible.

The forward chaining method in its simplest for is both highly accurate, highly irritating and also unable to branch to different lines of questionsing.

It is my hope to refine this approach in EarnestAI to allow a sort of hybrid FWD Chaining.  Basically, I am testing the concept of using a BAckward chaining algorithm that is executed after every answer.  The results will look forward to possibly proved solutions and then switch the path of questioning to a more realistic route.  For instance, if Earnest asks, “does it have 4 legs”, he will look forward to all solutions proved true by this question and then remove questions in the current question path that no longer relate to 4 legged animals.

Initial tests are good, but there are ome risks involved because once again, we are leaving it to the “heuristic reasoning” capability of the backward chaining engine to not ommit important questions.

Oh well, hope that you enjoyed the post.

by for now

Scot

EarnestAI

Saturday, January 30th, 2010

Morning,

Well I’ve been busy getting Earnies (his pet name) Sourceforge project in some kind of logical order.  Sorceforge is really quite cool tbh!  It’s been a good experience and setting up the project was really quite easy.

Since releasing the original PRE-ALPHA source code I have been busy trying to get it in some kind of understandable format. I confess even if I have been coding for over 29 years my source formatting is anything but conventional.  Its perfectly readable to me, but my indents and code blocks dont meet modern standards.  Hopefully my rich ue of developer comments will help people disipher whats going on.  For the first time ever I have also made use of a code beautifier to try and make it a bit more friendly to you all.

For those of you who dont know yet, EarestAI is coded in PHP.  I have become something of a PHP fan in the last 10 years as much of my commerial work is in web based applications and I find PHP extremely easy to work with. It took me almost zero time to migrate to it from C and C++ and I chose it to create Earnie so that he was portable but more importantly web based.

Omnipitent Ernie

I wanted Ernie to be web based purely becaus he is able to interface with anything connected to the Internet or even Intranets.  Email servers etc.  It is my hope that as he develops further “Intelligence” and cpability that he will be able to link to further reading, acces emails and play media files etc to enhance his users experience.  BUT above all this, web connectivity means that Ernie has the possibility to communicate with many people at the same time!!  Whats good bout that?  Well, he can possibly use input from one user to solve problems for another, and even remember to ask suitable new users to solve historical problems asked by others and even contact them by SMS with updated results etc.

Yesterday I only grabbed a couple of hours coding in between work, but I have managed to now separate Ernies inference engine (The part of Ernie that makes descisions) and have also tightened his security.

Experienced programmers will probably notice that the coding approach is rather old fashioned at present, that is I have made no use of PHP Classes and there is even a dreaded global variable “if only 1″.  To be honest, its not a big deal, I wanted at first to get a working input model, and my old hacker approach to coding is a bit bottom up on this one,  I just started coding and took it from there.  The application plan was almost non existent all i had was a 12 line plan of the data structure and a vision in my mind on how things would be stored and accessed.

Result: A messy code structure that is at best in efficient and at worse a bit lousy :-) but it works and I can understand it.  I have luckily employed functions heavily and have kept 90% of the page output to templates from the start, this will make it easier to eventually class the functions and create a simple and powerful web based API that can be pulled into almost any web based project and skinned to match the users needs at will.

In my next post I will be starting to write about the AI approach I have chosen for the EarnestAI project the well known Expert System and how hopefully with some new ideas this limited but also powerful model can make Ernie a clever little bunny.  I will also be hopefully setting up a FB page for Ernie fans to promote the project and get some more brains on the job.

Well gotta go, its snowing again and the snowboard beckons……