AI Research Project | mkv16

may 23, 2009 08:21pm

PHP Service Class

Part of my work, towards creating the AI, is improving my tool set. I've already spent a fair amount of time working on the blog, and software behind the scenes for administration. As such I released phpSimpleMyAdmin this week, which I hope to improve upon.

Also, I'm looking at improving a few of my sites with unobstrusive JQuery and "interesting" PHP web services (not the formal XML kind mind), but I revisited an old framework earlier and repurposed it into something simpler. I post it here as a template for future work.

<?php

$service = new Service();

class Service
{

	var $action;
	var $session;
	var $output;

	function Service()
	{
		$this->StartSession();
		$this->ProcessAction();
		$this->DisplayOutput();
		$this->SaveSession();
	}
	
	function StartSession()
	{
		session_start();
		$this->session = $_SESSION['Service'];
	}

	function ProcessAction()
	{
		$action = trim($_GET['action']);
		$method = 'action_'.$action;
		
		if($action == false)
		{
			$this->output = 'No action defined. ';
		}
		else
		if(method_exists($this, $method))
		{
			$this->{$method}();
		}
		else
		{
			$this->output = 'The action '.$action.' is not a valid service request.';
		}
		
		$this->session['count']++;
	}
	
	function action_RandomMessage()
	{
		$quotes = array('John is a creative individual', 'Haruhi is god', 'Kyonko is love', 'Lucky Star is slated by many', 'Meatloaf is a bat out of hell');
		$this->output = $quotes[rand(0, count($quotes)-1)];
	}
	
	function DisplayOutput()
	{
		echo $this->output . ' (' . $this->session['count'] . ') ';
	}
	
	function SaveSession()
	{
		$_SESSION['Service'] = $this->session;
	}

}
?>


Edit: Example of this working: JQuery Quote Picker.

Posted By: Markavian

2 comments | Comments

may 19, 2009 03:51am

People with super computers...

wolframalpha_search.png

Wolfram Alpha, "a new kind of search" is gaining media publicity. Its use of semantic search isn't a million miles away from the tasks I'm tryring to acheive here, but they've got about 20 years more research and a whole lot more algorithms to play with. I imagine its going to be a struggle to compete against such a massive knowledge base, but then again I don't need to. So long as I can build a basic framework for storing and processing knowledge locally then I can focus on the thinking parting of the machine.

http://www.wolframalpha.com/index.html

Posted By: Markavian

0 comments | Comments

may 15, 2009 08:32pm

Inference Results

inference_results.png

Have limited the InferenceEngine to parse to just two levels on a given search term.
The first pass matches against Notions in the Triple(Subject, Relation, Notion). The second pass uses the Subject of the first result to create a match. This aims to reveal inferences in the data structure. Further.

Today's screenshot shows the result of "person" applied to the sample data set (logged on the 29th April 2009). Encouragingly it came back with all the right results, and now I have become comfortable using TreeList and ListView components to display the results it has become much easier to identify and debug general case errors. The mix of teaching data and noisy chat side-by-side is welcome.

Posted By: Markavian

0 comments | Comments

may 10, 2009 07:53pm

A wide net

one the person person.png

I spent the evening debugging the first version of the Inference Utility, based off the Memory Browser which had a framework for loading the datafile under a thread. At present it takes 6 seconds to load 96000 entries, the dataset has 4000 triples

At the end of today's testing I feel I set the net too wide, after removing infinite loops in the recursive function and preventing matched items appearing twice, the resulting query took well over 5 minutes, on 4000 items; lots of interconnections. The first result for the search term "person" was:

person
nikov an angry person
it be, nikov
someone ate it

result 1 of person:
someone ate it.


Need to specify a relation, or only go one level down at a time. e.g. (list(is a, person). Considering my lack of reference material I've got a lot to figure out.

Posted By: Markavian

0 comments | Comments

may 09, 2009 07:17pm

Inference Engine

Today I started work on the inference engine, the component of my AI that will bring back hopefully useful results from the collective set of data. The example posted earlier illustrates the steps to achieve the answer, but is perhaps too complex for the set of data. Instead I'll rely on simpler more direct inferences and work up to more complicated queries.

command: list([people that live in cities]:string)
[people]:notion
  people -> is plural of -> person
   john -> is a -> person (X)


Aims:
1. Take the first token, bring back all results linked to that notion.
2. Create an interactive search utility (like the MemoryBrowser) to perform random case tests.

Posted By: Markavian

0 comments | Comments