Background: I am currently working on some predictive modeling of some client shopping data to see if it is possible to categorize clients into one of nine ordinal categories according to their spending habits. Our target variable is ‘client category’.

There are many rows of data per client (anywhere from one to a thousand).
So both the training data and testing data have multiple rows per client ID, though the amount of rows are different for each client. It would seem to me that one approach is to aggregate data into the format of one row per client (aggregating over grouping variable ‘client ID number’) and then apply some modelling techniques to this aggregated dataset.

I have tried this, the techniques I have tried are multi-layer perceptron, decision tree and random forests. With this approach I get some fair predictions (as high as 90%), but these predictions perform very poorly over some of the ordinal categories (the ones with low frequency don't appear in the predictions at all). I even converted the ordinal variable into a continuous scale and the predictions were still not as good as I would like.

I have tried to improve this model by aggregating over other indices such as median and standard deviation – not just the mean, in order to reduce information loss on aggregation. This has not had a large effect on model improvement.

Given the assumption that we can sometimes lose information by aggregating data, is there a model for machine learning on non-aggregated data, where we have a target variable, but also a grouping variable (in this case client ID)?

My gut feeling is time series analysis is not too different, just with the extra factor of time, so I think it is possible to add an extra factor as a grouping variable.

I understand this may result in a slow model (computationally).

P.S. I did try a two-step approach of applying machine learning algorithms to the initial (non-aggregated) dataset to produce some dummy predictor variables and then aggregate them when the rest of the model was aggregated, feeding them into the new model, but it did not seem to produce good results.

  • $\begingroup$ Be great if anyone has a suggestion for this, even if it is in just one area. Or a comment on one part of what I am doing. $\endgroup$
    – Joey
    Dec 5, 2015 at 10:07

1 Answer 1


This question is ancient, but it seems like you are looking for ordinal regression. Basically, for your 9 ordinal categories, you want to make 8 classifiers. The first classifier would be "is the category greater than 1 or less than or equal to 1?" The second classifier would be "is the category greater than 2, or less than or equal to 2?", etc.

If you're still looking for a solution to the problem, I'd look at the literature on ordinal regression. It may fit your problem better than aggregating your data or doing more complicated techniques first.

  • 1
    $\begingroup$ Thank you for the suggestion, I have actually found a solution, but I want to test it out a bit more before posting it as an option. I was disappointed not to get any answers, but at least I feel good that I worked something out ;) I am not sure your answer is exactly on the same page as me, but give me some time to look into it and I will get back to you :) $\endgroup$
    – Joey
    Jul 2, 2016 at 3:56
  • $\begingroup$ @Joey it's definitely not an answer to the question you posed, but I thought that given the context you described, an ordinal regression techniques would probably help with your problem of some of the categories not having a lot of data. I will be interested to see if it helps, though! $\endgroup$ Jul 2, 2016 at 5:29
  • $\begingroup$ Hi @Joey. I'm at the same stage you were when you made your question. I have a very similar problem and don't know how to proceed. Could you please give me some hint on how to approach the problem. Thanks in advance! $\endgroup$
    – ssoler
    Jan 9, 2017 at 15:58

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.