title: Using scikit-learn to training an NLP log linear model for NER
body: <p>I wonder how to use <a href="http://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html" rel="noreferrer"><code>sklearn.linear_model.LogisticRegression</code></a> to train an NLP log linear model for named-entity recognition (NER).</p>
  
  <p>A typical log-linear model for defines a conditional probability as follows:</p>
  
  <p><a href="https://i.stack.imgur.com/4Yp7D.png" rel="noreferrer"><img src="https://i.stack.imgur.com/4Yp7D.png" alt="enter image description here"></a></p>
  
  <p>with:</p>
  
  <ul>
  <li>x: the current word</li>
  <li>y: the class of a word being considered</li>
  <li>f: the feature vector function, which maps a word x and a class y to a vector of scalars.</li>
  <li>v: the feature weight vector</li>
  </ul>
  
  <p>Can <code>sklearn.linear_model.LogisticRegression</code> train such a model?</p>
  
  <p>The issue is that features depend on the class.</p>