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.

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

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.

  • 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. – svk Oct 10 at 3:34

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.