next up previous
Next: 3.2 Weight Learning Up: 3 Extending Alchemy Previous: 3 Extending Alchemy

3.1 Inference

Any new inference algorithm in Alchemy must fit into the existing class hierarchy (i.e. it must be a subclass of Inference). Therefore, it must implement the methods init(), infer(), printProbabilities, printTruePreds() and getProbability(), although it could be that no initialization is required (see, for example, UnitPropagation). The constructor of the new class should call the constructor of Inference so that the state and seed are initialized.

Every inference algorithm is called in the same manner in infer/infer.cpp. A VariableState is initialized and the pointer inference is set to the inference algorithm as specified on the command line. If a new inference algorithm is added, this should be extended (along with the command line options) to accomodate the new algorithm, i.e.: inference = new NewAlgorithm(state, seed, params); where params is a struct to hold the parameters specific to the new algorithm. Finally, init() and infer() are called which perform the inference and the probabilities (or best state) of the ground atoms are output to file by calling printProbabilities(). Of course, the header file of the new algorithm must be included in infer.cpp. The laziness or eagerness of the inference algorithm should be encapsulated in VariableState.


next up previous
Next: 3.2 Weight Learning Up: 3 Extending Alchemy Previous: 3 Extending Alchemy
Marc Sumner 2008-09-17