1
$\begingroup$

I am having a dataset under this form:

enter image description here

It is to be known that this is an ordered structure of data. In other words, custommer 11676 bought item 3297 ,rated it then bought item 776 and rated it.

Based on the user's historical records of bought items and ratings,we want to predict the rating of the next item. This is to my knowledge a kind of sequence classification problem.( Can somebody confirm?)

What I did so far is to transform the dataset into the following form:

Custommer Item1 Item2  Item3 ...  ItemN    Actual_Item     Target

11676     rating1 rating2 rating3    0        2310               1  

To be more precise here is an example based on the 2 first lines from the screenshot above:

Custommer Item3297 Item776 Item684  ActualItem Target
 11676       0         0       0          3297     1  
 11676       1         0       0          776      1
 11676       1         1       0          684      1

If an item haven't been bought by the custommer, I simply put 0 in its rating(assuming that this number isn't used for the ratings) I did this transformation mainly to be able to use classical classification algorithms(decision trees, svm ,multinomial naive bayes etc....)

Is this a good way to transform a sequence classification problem into a simple classification problem?

$\endgroup$

1 Answer 1

2
$\begingroup$

Typical time series data like temperature, share market data etc, and even natural language sentences can be examples for sequence classification problems. Now in your case, if you're just talking about predicting rating, you should also think about predicting the next bought item. You could use an RNN to predict next item to be bought and also its rating. Please read more about RNNs.

With that said, if you don't want to use RNNs, you could as well convert the problem into regular classification problem as you have done and it should work.

This may not exactly apply to your case, but one thing you may want to explore is "N-Grams","Bag of words", and "term document matrix". Basically N-grams tries to account for phrases instead of just using single words as features. If you have a sentence " I will give up drinking coffee", your one grams will be {I,will,give,up,drinking,coffee}. 2 Grams will be {"I will", "will give","give up","up drinking","drinking coffee"}. Of course, you will not consider all the n-grams as your features, only that n-grams that appear a minimum number of times.

In fact in some regular (Not deep learning)NLP problems, they convert sequence problems to regular classification problems.

$\endgroup$
5
  • $\begingroup$ Does RNNs require massive amoubt of data to be trained? $\endgroup$ Commented Dec 26, 2017 at 8:30
  • $\begingroup$ Yes. They usually do. More than what you would need for regular classification algorithm. $\endgroup$ Commented Dec 26, 2017 at 9:11
  • $\begingroup$ "In fact in regular (Not deep learning)NLP problems, they convert sequence problems to regular classification problems." This is an overstatement. Many NLP tasks used structured prediction algorithms like HMMs or Conditional Random Fields before RNNs became state-of-the-art $\endgroup$ Commented Dec 27, 2017 at 14:35
  • $\begingroup$ True. HMMs and CRFs are used in regular NLP. I was thinking about bag of words models.... $\endgroup$ Commented Dec 28, 2017 at 7:11
  • $\begingroup$ @damdam092 I've added some more information on bag of words, and n-grams which tries to account of words that appear together. $\endgroup$ Commented Dec 29, 2017 at 0:38

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.