Search code examples
stanford-nlplogistic-regression

Setting intercept in Stanford-NLP LogisticClassifier


I want to instantiate a Stanford-NLP LogisticClassifier using features/weights being read in from a text file (from a classifier trained separately).

The classifier I've trained (in Python, using scikit-learn) consists of weights, features, and also an intercept term. On the Stanford-NLP end, though, the classifier constructor doesn't take an intercept.

Is there any way to incorporate the intercept into my LogisticClassifier?


Solution

  • Yes; you can simply define a new feature (e.g., "bias" or "intercept"), and set the weight of that to be the intercept value from scikit-learn.