Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Choosing a data structure for AI applications

by Anonymous Monk
on Jul 16, 2002 at 06:23 UTC ( #182010=note: print w/ replies, xml ) Need Help??


in reply to Choosing a data structure for AI applications

You don't really need to map from prolog to perl, its pure semantics. You need to map from prolog to SQL via perl. Once you have achieved an effective mapping that way (possibly via a database schema compiler followed by a runtime interpreter or something), then you have achieved two things:

1. Gained all the benefits of advanced database optimisation in your fact storage and lookup

2. Achieved in one fell swoop persistance, load balancing, and external non-perlog access to the facts.

That said, it still isn't gonna be easy. Good luck :)


Comment on Re: Choosing a data structure for AI applications
Re: Re: Choosing a data structure for AI applications
by Ovid (Cardinal) on Jul 16, 2002 at 14:45 UTC

    Gah! I hate it when people post intelligently but do so anonymously. It suggests to me that they're not going to hang around the monastery. I certainly hope you do.

    Actually, last night I was doing quite a bit of thinking (and reading) about this problem and using a database seemed to be one of two solutions. Actually, a multi-value database like UniData would be awesome (it would handle lists very easily), but I don't know of any open-source versions.

    The other thought was to use directed graphs with adjacency lists. I think that would be workable and I could use DB_File to handle persistance. However, I am much more familiar with database theory so I think that would be better (and probably allow more people to contribute). The nice thing about databases is that I think they would solve the Unification problem very easily, if I can come up an easy scheme to create them on the fly (I'm seeing more deviation from Prolog already).

    Cheers,
    Ovid

    Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.

      I post here all the time but I never remember to log in and I keep killing all my cookies :)

      The problem thus far with the discussion is that everyone is talking like using a database costs you something, as if its slower than a perl hash or some more complex in-ram data structure.

      The truth is that, for a dataset that can fit reasonably in ram, perl is quicker. But once you talk about anything running into the millions of facts, a real DBMS will be unbelievably helpful. Indexing is a huge win for one, they do their own ram-based caching as well.

      So, let us consider that, short of re-inventing a specialist database engine with many of the features that a DBMS already provides, a DBMS would be the most effective fact store for any reasonably sized factset.

      Your next problem is how to effectively generate database schema in such a way that you get the most out of indexes, ordering and joins within the database without having to replicate data all over the place in different forms (an option, but an unhappy one).

      The first thing is to understand that you want a powerful RDBMS. The object databases, PostgreSQL included, have many benefits, and its possible that one could be appropriate, but in my opinion the area of relational systems has been the most examined and they have the best combination of performance and flexibility (postgresql isn't shabby though, so as a free backend it may well be worth it).

      From this you would then want to read up on reasonably advanced SQL, notably views, indexes, subselects and joins, and the performance parameters inherent in them. Many features of SQL will map directly to features of prolog with the relevant schema, for example a table of facts could represent, in two columns, the IS A relationship and retrieving the facts is a set of trivial SQL statements.

      Unfortunately, I don't know enough prolog to take the analysis further, but it would seem to me that, if you're serious about doing big performance-intensive stuff, which is where expert-system AIs become really valuable, that the RDBMS backend is the only real option.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://182010]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2014-07-26 04:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (175 votes), past polls