3
$\begingroup$

I recently came across the CRFSuite package for CRFs. Though, it is primarily used for NLP applications like POS tagging, i was wondering if I could use it to model time-series data as well?

Have any of you used CRFSuite? In the tutorials, the raw training data is of the format:

He PRP B-NP

reckons VBZ B-VP

the DT B-NP

current JJ I-NP

account NN I-NP

deficit NN I-NP

and they use a file (chunking.py) to convert it to training data format used in CRFSuite. The problem is, a sequence here consists of various labels and CRFSuite learns the model accordingly based on designed features / relationships. However, in my problem, I have a time-series data (force values ) and every value in the sequence is of the same label. For example, I have a time-series of force values of interaction with object type 1 and another time-series of force values of interaction with object type 2, and so inside a sequence all the labels are the same ( corresponding to the object type).

One sequence:

1.2 ob1

1.4 ob1

1.5 ob1

1.6 ob1

1.7 ob1

Another sequence:

1.4 ob2

1.3 ob2

1.1 ob2

0.5 ob2

0.1 ob2

I would like to use CRFs to classify objects into object types (ob1 or ob2) by looking at the time-series of force values. If I arrange the training data as shown above, it is unable to capture the relationship (whatever features i decide) and gives very low accuracy on testing data. So, I was wondering if any of you have any insights as to how to represent the data in my domain in this CRFSuite?

I have also tried to learn multiple models (each for each category) and then try to classify according to which model gives the highest likelihood of the observed data. But, even that trick did not work. Any pointers?

Thanks in advance for your help.

$\endgroup$

1 Answer 1

2
$\begingroup$

CRFSuite supports using feature weights, it is a little buried and easy to miss, but it is mentioned in the documentation here. Your training file would the en up looking something like

ob1 x[0]=x0:1.2
ob1 x[0]=x0:1.4
ob1 x[0]=x0:1.5

and so on. Notice with this format your CRF would only be modelling dependencies in the tag structure (the labels). It may help to use something like a sliding window

ob1 x[-1]=start x[0]=x0:1.2 x[1]=x1:1.4
ob1 x[-1]=xn1:1.2 x[0]=x0:1.4 x[1]=x1:1.5
ob1 x[-1]=xn1:1.4 x[0]=x0:1.5 x[1]=end

where now you are using the previous, current, and next value as features.

All that being taken care or, I'm not sure if CRFs are really the right tool for the task you describe. In typical applications of CRFs each element of the sequence gets a tag, where here you want to give a tag to each sequence.

Based on my own personal experience, I would start with something like the following:

  1. train two Hidden Markov Models (HMM), one for each for each object.
  2. for a sequence $s$ to be classified, pick the class of the HMM for which the probability of the sequence under the model is largest.
$\endgroup$
2
  • $\begingroup$ Thank you for your reply, alto. Yes, i did miss this. I will try to use this method and see if this works. I will keep you updated. As for your suggestion regarding the methods, I already implemented what you suggested regarding the HMM models. I had multiple models and picked the class which modeled the sequence with highest probability. However, I was wondering if using CRFs (which models the conditional probability) might give better results for classification purposes. $\endgroup$
    – Gilmour
    Commented Oct 5, 2013 at 20:44
  • $\begingroup$ "where here you want to give a tag to each sequence." While Hidden Markov Models will do as you describe, there is also the related hidden CRF, which functions in much the same way, with all the other "benefits" of a CRF (depending on ones perspective and needs). $\endgroup$ Commented Aug 13, 2014 at 19:59

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.