Multiple variable as input and output I'm trying to predict the possible diagnosis given a consultation reason. I have ID's for all the data. So my data kind of looks like below

Reason            | Diagnosis
------------------------------
448, 124          | 9
551, 448, 122     | 9, 12
111, 110          | 32
143               | 43


There can be up to 10 reasons and upto 5 diagnoses in my training data.

What I'm looking for in the algorithm or model is that it accepts 1 - 10 reason_ids as input and returns top 5 possibilities for diagnosis with % of probability.

I'm good at python so if there is any open source model or code I can look at it will be great.
You could approach this in two ways:


Association-rule learning


Intuitively, it's like trying to infer rules such that: if the reasons are X and Y, the diagnosis will likely be Z.

The most common algorithm is Apriori, which is easy to implement.


Classification/Supervised learning


Your features could be binary (0 if reason X is not applied, 1 if it is). You could have one for each reason, and even combination of reasons etc. You might run into some issues if you have many possible reasons (your features will be very sparse).

If this is the case, I'd look into dimensionality reduction to make your features denser.