Frequently Asked Questions

Does Alchemy work on Windows / Mac?

Alchemy has been tested for basic functionality on Cygwin and on Mac. Since there are many flavors of Windows and Mac OS, we are dependent on user reports to achieve wide portability. If you have or have not been able to use Alchemy on Windows or Mac, please share your experience with us.

What does the error message std::bad_alloc mean?

This means that Alchemy has run out of memory. If this is a very large dataset, then it often helps to run lazy inference (-lazy) or lifted belief propagation (-lifted -bp). It is also easy to mistakenly design a model for which these two methods do not help. In this case, the model should be simplified and/or the size of the dataset reduced.

How big of a domain can Alchemy handle?

The answer to this question depends on many variables. Important for Alchemy in terms of the size of a domain is the arity of the clauses and the number of constants in the domain. We have handled domains with more than 10 million ground clauses on machines with 4GB of memory.

I have a very simple domain and I'm not getting the results I would expect from inference. What's wrong?

This could be a number of things. First of all, remember that Alchemy is performing approximate inference, designed to estimate probabilities of mainly large data. On small datasets, where you can compute the marginal probabilities by hand, approximate inference will have some error (it is, after all, approximate inference).

Another source of error is the model itself. As Markov logic allows non-i.i.d. models, it is very easy to inadvertently introduce unwanted dependencies in the model, causing unexpected results.

Yet another problem could be the data itself. Often a very small dataset contains unwanted dependencies that are not readily apparent. It is best to have sufficient and real data.

How do I convert a Bayesian Network to an MLN?

For each (conditional) probability distribution in your Bayesian model, e.g. P(E | A,B,C,D), add one conjunction for each possible assignment of values to the variables it covers (A-E) with the logarithm of the probability as the weight, i.e. if p=P(E=e | A=a,B=b,C=c,D=d), add the conjunction

log(p) A=a ^ B=b ^ C=c ^ D=d ^ E=e

where A=a,B=b,... are appropriate atoms. For example, if you have a non-boolean attribute such as "height", they could be atoms like "height(x,Tall)", and you should declare the relation as functional, e.g. "height(person,domHeight!)".

This results in a direct translation of the Bayesian model, where the products in the MRF correspond directly to the factorization of the full-joint in the Bayesian model and Z=1.

Can a constant belong to more than one type in my MLN?

Yes, in the latest version of Alchemy, the set of constants of one type can overlap with another.

When should I use an implication and when a conjunction?

If you are only conditioning on the antecedents, then the two models are equivalent. However, if you have non-evidence in the antecedent, then using an implication will not produce the desired model. In this case, use a conjunction.