next up previous
Next: 2.1 Uniform Distribution Up: The Alchemy Tutorial Previous: 1 Introduction

2 The Basics

Alchemy has been designed to run on the Linux platform. After downloading it, unzip and untar the file with tar xvfz alchemy.tgz. This creates a directory alchemy which contains the source code and documentation. In the file alchemy/src/ type make depend; make which will produce the executables learnstruct, learnwts, and infer in the directory alchemy/bin/. If you have problems making the executables, please consult the user's manual, as Alchemy is dependent on other programs being present. Throughout the tutorial, these three commands will be used without specifying the location of them.

Alchemy can perform three basic tasks: structure learning, weight learning, and inference. The former two involve learning the structure or parameters of a model given a training database consisting of ground atoms. The latter involves inferring the probability or most likely state of query atoms given a test database consisting of evidence ground atoms.

The two learning commands, learnstruct and learnwts take the same basic arguments as input:

-i <string> Input .mln files
-o <string> Output .mln file
-t <string> Training .db files

All other arguments are optional and are set to a default value if not specified. For a list of all command line options, the reader should consult the developer's manual.

To perform inference, the command infer requires an MLN with weights (either learned or hand-crafted), evidence on which it conditions and a set of query predicates:

-i <string> Input .mln files
-r <string> Output file containing inference results
-e <string> Evidence .db files
-q <string> Query atoms (comma-separated with no space)

Again, many other options are available which can be found in the developer's manual. One important default at this point is the type of inference being performed. Alchemy can perform MAP inference which outputs the most likely state of the query atoms or probabilistic inference which outputs marginal probabilities of the query atoms given the evidence. The latter is the default.

We have encountered two file types: .mln files and .db files. The former contains the MLN used for inference or learning, the latter contains a set of ground atoms used as training examples (when learning) or evidence (when running inference). A .mln file consists of two basic parts: declarations and formulas. The declaration section must contain at least one predicate, while the formulas section contains 0 or more formulas. Optionally, one can enumerate the constants of each type used in the .mln and .db files; if there is no enumeration, the set of constants is implied from all constants present in both files. A .db file consists of a set of ground atoms, one per line. Evidence predicates are assumed by default to be closed-world, meaning that if they are not present in the .db file, they are assumed false. Non-evidence predicates, on the other hand, are assumed open-world by default. The full syntax of the files can be found in the user's manual; however, the basics needed to get started should become apparent as you read this tutorial.

Now that we know the basic commands and file types available in Alchemy, 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: 2.1 Uniform Distribution Up: The Alchemy Tutorial Previous: 1 Introduction
Marc Sumner 2010-01-22