Feature function for logistic regression In his Natural Language Processing textbook, Eisenstein defines the logistic regression as follows:
$$p(y|x,\theta) = \frac{\exp (\theta f(x,y))}{\sum_{y'} \exp (\theta f(x,y'))}$$
Where $\theta$ are the regression parameters and $f(x,y)$ a given feature function. My question concerns the feature function we just defined as a function of $x$ and $y$. Indeed, I can't grasp why Eisenstein's feature function also takes the label $y$ as an input. From my understanding, in standard regression (e.g. multiple linear regression), the feature function is a way to catch non-linearities in the data by projecting data point $x$ in a well-chosen feature space using the feature function $\phi(x): X \rightarrow{} F$. But I can't really see when and how having label $y$ is useful.

This is basically a notational variant of standard logistic regression. In that case, the distribution looks like $p(i|x,\theta)\propto e^{x\cdot w_i}$, where $w_i$ is a vector of coefficients corresponding to the $i$th class. This corresponds to using a feature map in which $x\mapsto f(x,y)$ is linear for each fixed $y$. I would imagine that this is being introduced with an eye towards using more complex feature maps later on.
