  The hardcore model on a graph $G$ with parameter $\lambda>0$ is a probability
measure on the collection of all independent sets of $G$, that assigns to each
independent set $I$ a probability proportional to $\lambda^{|I|}$. In this
paper we consider the problem of estimating the parameter $\lambda$ given a
single sample from the hardcore model on a graph $G$. To bypass the
computational intractability of the maximum likelihood method, we use the
maximum pseudo-likelihood (MPL) estimator, which for the hardcore model has a
surprisingly simple closed form expression. We show that for any sequence of
graphs $\{G_N\}_{N\geq 1}$, where $G_N$ is a graph on $N$ vertices, the MPL
estimate of $\lambda$ is $\sqrt N$-consistent, whenever the graph sequence has
uniformly bounded average degree. We then derive sufficient conditions under
which the MPL estimate of the activity parameters is $\sqrt N$-consistent given
a single sample from a general $H$-coloring model, in which restrictions
between adjacent colors are encoded by a constraint graph $H$. We verify the
sufficient conditions for models where there is at least one unconstrained
color as long as the graph sequence has uniformly bounded average degree. This
applies to many $H$-coloring examples such as the Widom-Rowlinson and
multi-state hard-core models. On the other hand, for the $q$-coloring model,
which falls outside this class, we show that consistent estimation may be
impossible even for graphs with bounded average degree. Nevertheless, we show
that the MPL estimate is $\sqrt N$-consistent in the $q$-coloring model when
$\{G_N\}_{N\geq 1}$ has bounded average double neighborhood. The presence of
hard constraints, as opposed to soft constraints, leads to new challenges, and
our proofs entail applications of the method of exchangeable pairs as well as
combinatorial arguments that employ the probabilistic method.
