next up previous
Next: 3.4.1 Memory-efficient inference Up: 3 Quick Start Previous: 3.3 Structure Learning

3.4 Inference

To perform inference, run the infer executable, e.g., ALCHDIR/bin/infer -i univ-out.mln -e univ-test.db -r univ.results -q advisedBy,student,professor -c -p -mcmcMaxSteps 20000.

-i specifies the input .mln file. In that file all formulas must be preceded by a weight or terminated by a period (but not both). An exception is a unit formula with variables followed by the ! operator. Such a unit formula can be preceded by a weight, or terminated by a period, or neither. (For such a unit formula, the code automatically creates formulas stating that the variables have mutually exclusive and exhaustive values. See Section 4.) Each formula in the input .mln file is converted to CNF. If a weight precedes the formula, it is divided equally among its CNF clauses. If the formula is terminated by a period (i.e., the formula is hard), each of its CNF clauses is given a default weight that is twice the maximum soft clause weight. If neither weight nor period is specified for a unit formula with variables followed by !, each of its CNF clauses is given a default weight that is 1.5 times the maximum soft clause weight. (See Section 6.2 on how to change the default weights.)

-e specifies the evidence .db file; a comma-separated list can be used to specify more than one .db file. -r specifies the output file which contains the inference results.

-q specifies the query predicates. You can specify more than one query predicate, and restrict the query to particular groundings, e.g., -q advisedBy(x,Ida),advisedBy(Ida,Geri). (Depending on the shell you are using, you may have to enclose the query predicates in quotes because of the presence of parentheses.) You can also use the -f option to specify a file (same format as a .db file without false and unknown atoms) containing the query ground atoms you are interested in. (You may use both -q and -f together.)

By default, all first-order predicates are open world. You can control the open/closed-world assumptions with the -c and -o options. Type ALCHDIR/bin/infer without any parameters to see all available options.

Alchemy supports two basic types of inference: MCMC and MAP/MPE. The current implementation contains three MCMC algorithms: Gibbs sampling (option -p), MC-SAT [6] (option -ms) and simulated tempering [5] (option -simtp). When MCMC inference is run, the probabilities that the query atoms are true are written to the output file specified. -mcmcMaxSteps is used to specify the maximum number of steps in the MCMC algorithm.

To use MAP inference instead, specify either the -m or -a option. The former only returns the true ground atoms, while the latter returns both true and false ones. For MAP inference, the output file also contains the weight assigned to a hard ground clause, fraction of hard ground clauses that are satisfied, the sum of their weights, and the sum of the weights of satisfied soft ground clauses. During MAP inference, each hard clause (derived from a hard formula with a terminating period) is given a weight that is the sum of the soft clause weights plus 10.

The MAP inference engine used in Alchemy attempts to satisfy clauses with positive weights (just as in the original MaxWalkSat algorithm) and keep clauses with negative weights unsatisfied. As an extension to the MaxWalkSat algorithm, when a clause with a negative weights is chosen to fix, all atoms in that clause are set to false.



Subsections
next up previous
Next: 3.4.1 Memory-efficient inference Up: 3 Quick Start Previous: 3.3 Structure Learning
Marc Sumner 2006-06-26