next up previous
Next: 3.1 Uniform Distribution Up: The Alchemy Lite Tutorial Previous: 2 TML

3 The Basics

Alchemy Lite has been designed to run on the Linux platform. After downloading it, unzip and file with unzip This creates a directory al which contains the source code and documentation. In the folder al/ type make al which will produce the executable al in the directory.

Currently, Alchemy Lite can perform the task of probabilistic inference. This involves inferring the probability or most likely state of a query in TML given a test database consisting of evidence facts in TML.

To perform inference, the command al requires a TML Knowledge Base, evidence on which it conditions. Optionally you can specify an output file and a query predicate or MAP inference:

-i <string> TML Knowledge Base Input .tml file
-e <string> TML Evidence Input .db file
-q <string> Query (Optional) Relation(Obj,...), Relation(Class,...), Attribute(Object,Value), Has(Obj1,Obj2,Subpart Relation), or Is(Obj,Class)
-map Use MAP inference (Optional)
-o <string> Output file (Optional) Specifies a file to output the result of the query (or MAP inference). If not specified, Alchemy Lite returns an answer to stdout.

If the query flag (-q) or MAP flag (-map) is absent on the command line, Alchemy Lite begins its iteractive mode. In interactive mode, a user can make multiple queries, add basic evidence, save the new evidence, and run MAP inference, after loading the TML KB only once.

Probabilistic inference in Alchemy Lite outputs marginal probabilities of the query atom given the evidence. Alchemy Lite can also perform MAP inference which outputs the most likely state of the query atom.

We have encountered two file types: .tml files and .db files. The former contains the TML KB used for inference, the latter contains a set of ground atoms used as training examples (when learning) or evidence (when running inference). A .tml file consists of a set of class declarations. Each class declaration describes that class's subclasses, subparts, relations, and attributes:

class ClassName {
subclasses Subclass1 wt1, Subclass2 wt2, ..., SubclassN wtN;
subparts SubpartClass1[n], SubpartClass2 SubpartRelation2[n], SubpartClass3 SubpartRelation3, SubpartClass4, ...;
relations Relation(SubpartArg,...,SubpartArg) wt, HardRelation(SubpartArg), !NegHardRelation(), ....;
Attribute1Name val1 wt, val2 wt, ...;
Attribute2Name val1 wt, val2 wt, ...;

Lines of the class declaration begin with keywords to denote what information they contain. Lines for attributes just begin with the attribute name.

Subclasses have the form <name of subclass> <weight of subclass>.

Subparts have four different forms. Each subpart relation states the class of the subpart. Then there is an optional name of the subpart relation; if no name is given, the name of the class is used as the subpart relation. Finally, an integer n states the number of subparts of this subpart relation. If the integer is missing, the default is 1.

Relations are defined as RelationName(args). The arguments must be names of subpart relations for the class. If no weight is given, the relation is set to be hard. Weights for the negation of relations are defined by using tthe ! symbol before the relation, e.g., !Parent(Family,Adult,Child) -0.1.

Attributes are each defined on their own line with the form <name of attribute> <name of value 1> <weight of value 1>, ..., <name of value n> <weight of value n>;. Attribute values are mutually exclusive and exhaustive.

A .db file consists of a set of object declarations representing the evidence known about the world. Each declaration begins with the object's class and name and then describes any known subclass information, its subparts, any relations that are known about its subparts, and any attributes known about the object. An example for a family might be:

Family Smiths {
Adult[1] Sam, Adult[2] Avery, Child[1] Anna;
Parent(Sam,Anna), !Parent(Avery,Anna);
Income MiddleClass;

Now that we know the basic commands and file types available in Alchemy Lite, we can move step by step from simple to complex problems. We end this section with the modeling of a uniform and binomial distribution and make a natural progession to logistic regression, hidden markov models, etc. , showing real-world applications along the way.

next up previous
Next: 3.1 Uniform Distribution Up: The Alchemy Lite Tutorial Previous: 1 Introduction
Marc Sumner 2010-01-22