I'm trying to classify about 5000 time series for patient admissions into two groups. which consists of large time gaps on nothing (months or years) followed by a short period of a significant number of data points, an admission. Each data point consists of a code (out of 6000 codes) or a code and a numerical value.

Not every time series contains every code, and the codes are quite sparse. I've tried to look at the distribution of values in each code, but got nothing. I've tried a naive Baysian approach of looking at the probabilities of codes in each set, after ignoring any values associated, and did a little better. I'm now out of ideas. I looked at RNNs, but thought the long gaps in data would affect their performance.

I looked at GLM's but the missing data and high dimensionality worried me.

If anyone could suggest a technique that might offer some traction, I would be very grateful.


1 Answer 1


If I understand correctly, a single patient would be one feature, so one column, and they had interations with hospitals over short periods; followed by no interations (and therefore no data) over longer periods.

Due to the sparsity of data along each single time-series, perhaps you could look into ways to encode the information a little more consicely. I think this approach may lead to fairly good results because you are only aiming to categorise the patients into one of two groups.

This could perhaps be done by converting your base data into more insightful statistics. For example, for each patient, you could compute some standard values:

  • Number of time periods with(-out) hospital interaction
  • Number of different codes (assuming the code refers to the ailment or something useful?)
  • Average length of gap between periods of activity
  • Average length of periods of activity

For the above, you'd need to probably heuristcally define what a "period of activity" is, e.g. 5 data points within 100 timesteps. Otherwise you're in a "gap" between such periods.

This would dramitically reduce the amount of datapoints and lend itself quite well and allow you to use simpler classification methods, such as GLMs, logistic regression (as you only have two classes) or perhaps a simple feed-forward neural network.

The idea is to extract as much of the temporal aspect from the data as possible during this feature engineering/pre-processing, such that formal time-series modelling would become unnecessary.

If you want to try normal time-series, such as regression models, you need to remember that they return a numerical value by default (regression problem versus classification), so you would need to decide on a threshold to put patients in one of the two groups.

Try trying to encode the missing data simply as a count of timesteps between datapoints would not work because of the fact that each patient has different timelines, so the resulting data would have strongly varying dimensions, making many models unusable.

  • $\begingroup$ Thanks for this. I tried to summarise the statistics in the time series, and add these to the results of the naive bayesian using a random forest, but it didn't improve the classification success noticeably. I used days spent in hospital, number of visits and time since previous admission. $\endgroup$
    – James
    Nov 1, 2018 at 10:06

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.