I have a dataset as (var1, var2, out), where the ordered pair <var1, var2> gives out. Most of the frequent pattern mining algorithms like the Apriori and FP growth algorithms do not preserve the order of var1 and var2.

Which are some of the available pattern mining algorithms (maybe also a NN trick), to find association rules between ordered pair <var1, var2> and output variable out?

  • $\begingroup$ What about KNN? $\endgroup$ Commented Nov 13, 2018 at 18:28
  • $\begingroup$ Can you please describe more on the suggested approach? As it is a big data problem, not sure what would be a reasonable value for k in KNN. $\endgroup$ Commented Nov 13, 2018 at 18:32
  • $\begingroup$ Maybe KNN is not the best choice if you deal with Big Data. What is the distributions of your features and outcomes? $\endgroup$ Commented Nov 13, 2018 at 21:57
  • $\begingroup$ in general pattern analysis is done with Markov models and also based on data, industry also algorithm changes $\endgroup$
    – sai saran
    Commented Nov 14, 2018 at 14:46
  • $\begingroup$ Can you give us more information? You have only two input variables? Or the variables are sets? The outcome is discrete? $\endgroup$
    – rapaio
    Commented Nov 15, 2018 at 6:09

2 Answers 2


Assuming you only have these two features (var1, var2), you might want to: * Create one-hot encoded features for each variable under each position. * Add a column on which variable is first (e.g. two columns - likely to work with trees but not with anything else). * Take each possible combination of variables and use that as your only input (e.g. you then take the average of out for that combination, perhaps adding some prior or smoothing).

As the comments mentioned, if out is some discrete event, maybe you'd want to instead look at Markov models.


Sequence mining seems the thing you are looking for. Used quite extensively in problems with ordered data, e.g. mapping DNA sequence -> disease. There are algorithms like SPADE and PrefixSpan.


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.