Consider a random field on Zd with finite spin space where the
spin at each site depends on a "random" number of neighborhood symbols. We
call this neighborhood the "context" of the site in analogy with the notion
of variable-length Markov chains defined by context-trees in one dimension.
Our motivation is two-fold : on the one hand we are aiming at finding a
parsimonious description of our data by using higher order Markov
dependencies if needed, and using lower order dependencies if possible.
This is in the spirit of an extension to d dimensions of the Minimum
description length principle introduced by Rissanen 1983. In a second step
we introduce an estimator of the length of the context. We prove the
consistency of the estimator and give precise error bounds for
the probability of over- and underestimation.