I am working on a sequence labeling task where, based on experience, many of the labels of a given input sequence can be reliably extracted with a simple rule-based approach. For example, considering the following input sequence:

[1, 2, 3, 1, 2, 1, 1] (ground truth labels of input sequence)
[1, X, 3, 1, 2, 1, Y] (labels as extracted by the rule-based approach)

In the above example, the rule-based system was able to extract all but two labels from the input. That is, only X and Y still need to be determined by a machine learning approach.

Are there known ways or algorithms to incorporate the labels extracted by a rule-based system into the machine learning process instead of running a sequence labeling algorithm from scratch? Intuitively, the additional information from the rule-based system should make it "easier" for the machine learning algorithm to fill the remaining slots.

  • $\begingroup$ What is the logic of this sequence? $\endgroup$ Commented Mar 8, 2020 at 7:59
  • $\begingroup$ @SandeepBhutani It always starts at 1, increases one by one until it reaches a threshold (e.g. 10) and then is reset to 1. $\endgroup$
    – zepp133
    Commented Mar 12, 2020 at 6:57

1 Answer 1


You can train a regular sequence labeling model (typically CRF) where one of the features is the rule-based predicted label: its value is the actual label when known or a special unknown value otherwise. Given that the model can take into account dependencies between labels (as specified in the parameters) and that the rule-based feature always gives the label except if unknown, the model should be able learn:

  • in which cases it should "trust" the rule-based feature (when value is not unknown)
  • to predict the missing labels by exploiting both the features and the known labels.

Note that in some rare cases the model might still predict a wrong label even if the rule-based label is provided. That would happen if the probability of the sequence is maximized in this way, but it's unlikely to happen if the training data is representative of the distribution.


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.