So, i am constructing a dataset (from doctor prescription notes and diagnosis) where

X (input features) represent the various snowmed codes for illnesses/surgeries performed/chronic conditions etc.

Y is a set of pills prescribed for X.

Presently I do not have this data in a matrix format. For ex. i have the snowmed codes for an illness that reads as follows: "Diabetes, Hypertension, Cardiac arrest, Left MCA stroke". Y is the set of pills that the doctor noted down for the above.

As one can note, the above data is not in a matrix format. There are many snowmed codes and various different pills overall. I'd like to apply ML algorithms to predict the pills for a given set of snowmed codes about the illness.

How to organize this data in a format convenient for ML? I am open to other analytics approaches as well. Any discussion in this matter will be helpful.

  • $\begingroup$ Is it many to one, one to many or many to many mapping? I suppose you could use multi class, multi label classification. $\endgroup$
    – Danny
    Oct 8, 2018 at 8:24
  • $\begingroup$ @Danny so, we can have a combination of diseases or illnesses in a patient and so, a combination of pills can be prescribed. $\endgroup$ Oct 8, 2018 at 9:30

1 Answer 1


In that case, Multi Class Classification will be the best approach. You can use Neural Network approach or K-Nearest Neighbours for this problem. Your DataFrame is going to be really sparse if you take a numeric approach.

From my point of view, the best approach is to build a vector model.

Multi Class Classification

After you arrange your data this way, it's easier to build a topic model using NLP techniques. It can also tell you which illnesses are most similar and which codes are similar.

This is what I could think of. These sort of questions are very open ended and can often lead to creative approaches. I am sure there'll be something better if you think hard enough.

  • $\begingroup$ Thank you. About the table,it is more like: Patient IDs,Disease Code,Pills prescribed 1,"C300067, C23381, C352000","XYZ, PRE, GTU" 2,"C34922, C300067, C2311","GHH,KLL,GTU" So, given a new set of codes, find pills. $\endgroup$ Oct 10, 2018 at 3:34

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.