2
$\begingroup$

I have a dataset concerning patients with information about their diseases and symptoms. I want to estimate probability of $P(disease_i = TRUE|symptom_j = TRUE)$. My intuition is that I should use a Naïve Bayes classifier, but every example I've found applies Naïve Bayes when there's only one disease (like predicting the probability of heart attack).

My data looks like this:

patient | disease | if_disease_present | symptom

1       | d1      | TRUE               | s1
2       | d1      | FALSE              | s2
3       | d2      | TRUE               | s1
4       | d3      | TRUE               | s4
5       | d4      | FALSE              | s8
...

My idea was to split data according to diseases and build the number of naive Bayesian models how many unique diseases I have in my data, but I have doubts if it's proper method.

UPDATE: Assume that I want to predict probability $P(X|Y)$. It's clear for me how to use R's implementation of Naïve Bayes when my $X$ is for example cancer/not cancer or a/b/c/d (or like here where $X$ is binary).

My difficult is "how to estimate $P(X|Y)$ when $X$ is more "complex". In my data I would like to predict conditional probability of some diseases (let's say number d3) when this disease is present under some symptom; because I have also rows with patients who were tested if they suffer from d3 but for whom the value of if_disease_present for d3 is $FALSE$.

FURTHER UPDATE: I would like to consider the presence/absence of all unique diseases in ONE model. Every patient could be connected with more than one disease and could have it or not.

$\endgroup$
1
$\begingroup$

The short answer is yes, Naive Bayes can predict many different classes (A vs B vs C vs ...), and is not limited to just two classes ("disease" vs "no disease"). What you're describing is a multinomial Naive Bayes classifier.

I suppose that I should use NB classifier

Why not SVM or random forest? There are lots of different classifiers, with advantages and disadvantages for different data and needs. If you provide more information about what you're doing we can comment on which, if any, are best for your case.

Edit: Responding to your comments:

Assume that I want to predict probability P(X|Y)

If that's all you want, why not just calculate $P(X|Y)$? A Naive Bayes classifier compares probabilities and selects the most probable class. If you're interested in guessing classes, i.e. classifying, there are ways to do it that don't explicitly calculate $P(X|Y)$.

But I have problem how to estimate this probability when I have X more "complex". In my data I would like to predict conditional probability one of some diseases (let's say number d3) when this disease is present under some symptom... To add more correct: I would like to use classes of all unique diseases and if they were or not as subclasses in ONE model.

If you do really want to use a classifier, whatever method you use, explicitly define the classes you'd like to be predicted. All classes are mutually exclusive: the classifier will guess one or another, but not combinations of classes (there may be methods to do the latter, but I'm not aware of how to do that with a classifier). I'm not totally sure what you mean. If there are N unique diseases and M combinations of diseases and symptoms, then you have M+N classes. Label each row in the training set with a number between 1 and M+N. The classifier will then guess one of these numbers for unlabelled, i.e. testing, rows.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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