I have a dataset where I am working on a binary classification. I have two classes of subjects. One is Outpatients and Other is Inpatients. (66:33 is the class proportion)

My objective is to identify the risk factors that influence hospital admission (Inpatients).

But the problem here is, I have my dataset like as below

1) Let's say we have a subject called "John". He has visited hospital 19 times based on my data duration from Jan 2001- Dec 2005. All of his 19 visits are outpatients.

2) Let's say we have another subject called "Jack". He has visited the hospital 34 times based on data duration from Jan 2001-Dec 2005. Out of 34 visits, he has been admitted as inpatient 18 times and rest 16 are outpatient visits.

So now my question is

1) Usually for analysis, we only see one record per subject/individual. Right? But now on what basis should I pick that one record?

Meaning, for John out of his 19 visits, which one should I pick?

Similarly for Jack, out of his 18 inpatient visits, which one should I pick?

I choose only one out of 18 from Jack because we don't need his outpatient info as we already have a separate group of outpatients and jack is considered for Inpatient class (because he has inpatient records too unlike John).

2) Is it really necessary to have only one record per person for analysis? Is there anyway to do this? Or is it like I have to represent in aggregate form the info of multiple records in one record? Is there any theory that allows analysis of multiple records for an individual?

Hope my question is clear and kindly request you to help me

  • $\begingroup$ I may be misunderstanding but, assuming you're trying to identify what causes hospital admission, why do we need to know who John or Jack is? I would think that the surrounding symptoms are the major relevance for the model, and that every hospital visit stands on his own, regardless of patient but rather symptoms X lead to hospitalization. $\endgroup$
    – Shushan
    Feb 5, 2020 at 7:42
  • $\begingroup$ Yes, we don't have to know who John or Jack is. But what we have to know is each subject has/can have multiple measures in the data. Usually in logsitic regression sample tutorials, I see that each subject has only one record. So they finally just do a classification. But now how do we do it? $\endgroup$
    – The Great
    Feb 5, 2020 at 7:47
  • $\begingroup$ Maybe I just don't understand the goal. What are you actually trying to achieve? I understand the binary classification but for what end? What are your input features? $\endgroup$
    – Shushan
    Feb 5, 2020 at 7:54
  • $\begingroup$ 1) My objective is to identify the risk factors that influence hospital admissions 2) usually we see that in multiple studies, we can minimize the hospital expenses if there is a good outpatient care for certain diseases like T2DM. My input data has info about patients drug consumption/prescription, his lab measurements results, his visit history to hospital etc. $\endgroup$
    – The Great
    Feb 5, 2020 at 7:58
  • $\begingroup$ Though my aim is to identify the risk factors for hospital admission, I see that without doing classification, you can;'t get at risk factor determination. $\endgroup$
    – The Great
    Feb 5, 2020 at 8:02

1 Answer 1


I will try and be as concise as possible. First, let's redefine the way you think about your data points. There can ever only be two types of visits in terms of time. Periodic and Non-Periodic. Let's call each visit an event. Some events could be related to chronic conditions where periodic visits are quite common. Some events could be related to flu, head injury, etc., These are non-periodic visits. You need to think about what you are trying to predict. Are you predicting an inpatient visit based on periodic events or non-periodic events?

1) I would not recommend picking a single record in multiple visits as it is insufficient. For example, if I come in for a visit for a Blood Pressure Check-Up and you pick that event, then that means you only get that information but where as I would be visiting for a follow up check up or something like that or it could be pre-surgery visits. Some of these events could be both inpatient and outpatient depending on the nature of the event. It is also possible that some of the outpatient visits will lead to an inpatient visit. Jack's earlier outpatient visits could be a sign of him coming in as an inpatient. All of John's visits are outpatient but will he ever be an in-patient? Is that what are you trying to predict?

2) You can definitely have multiple records per person and treat them as a sequence of visits over a period of time. This basically means that you are treating these visits as sequences. Most of the health care related risk prediction stuff is based on sequences. It is just the way you treat sentences. Each patient is described by a sentence of visits. This meaning, you can leave John's visits and Jack's visits as they are and use padding techniques to make them appropriate for a deep learning solution to classify which one would be inpatient.

You can refer to this paper.

This is definitely not concise but the number of permutations and combinations when it comes to healthcare stuff is high. Please let me know if you've got any questions.

  • $\begingroup$ Hi, thanks for the response. Upvoted. Yes your answer did give me a direction to approach this problem. Will try and reach out to you for any more questions $\endgroup$
    – The Great
    Feb 7, 2020 at 1:23
  • $\begingroup$ Hi, I was reading your answer again to understand better. Yes, I have two groups of people inpatients (who could have both inpatient and outpatient visit) and outpatients (who only have outpatient visits). Like you said in the answer, "all of John's visit are outpatient, but will he ever be an inpatient", yes am trying to predict something like this $\endgroup$
    – The Great
    Feb 12, 2020 at 1:42

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.