I am using Mallet CRF library and having training set sequences like below.

KFC     Bangalore  INDIA        <--- Sequence
PLACE   CITY       COUNTRY      <--- Target Label

During training/validation time, I don't have any features. While testing time, I give features like below.

KFC                 Bangalore            INDIA                  <--- Sequence
PLACE_LIKE(1.0)     CITY_LIKE(1.0)       COUNTRY_LIKE(1.0)      <--- Features
  1. Since there is no features in the training time, will these runtime features are useful?
  2. I believe, the association of features and target label is happening during the training time itself so any new feature directly comes during runtime will not get associated to target label and useless, is that correct?
  3. Can i attach Bangalore with CITY_LIKE(1.0) while training and pass lower weight feature CITY_LIKE(0.5) during testing time? Will that has impact?

1 Answer 1


I assume you're training a CRF model, or some other variant of sequence labeling, right?

I'm not especially familiar with Mallet but it's very unlikely that any model would let you add features at testing stage: the trained model and the test data must have exactly the same features, no more no less.

Apparently the features you want to add consist of a similarity score with a few particular categories, I assume this score is calculated independently during pre-processing? If yes this would usually be represented like this in the data:

<token>   <PLACE_LIKE> <CITY_LIKE> <COUNTRY_LIKE> <label>
KFC       1.0          0.0         0.0            PLACE
Bangalore 0.0          1.0         0.0            CITY
INDIA     0.0          0.0         1.0            COUNTRY

Note that this format with token + N features must be followed in both the training and test data. Therefore you must apply the same pre-processing steps for both.

  • $\begingroup$ plusOne, Thank you! $\endgroup$ May 12, 2020 at 18:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.