# How to calculate probability of coming from a dataset for a sampled instance?

Suppose we have two datasets $A$ and $B$ with size $S_A$ and $S_B$. Instances of datasets have multiple features. Consider the specific features $X$ and suppose we are given $PDF$ of this feature in each dataset. Now we take a random instance and observe that $X=1.2$ for this instance and we want to guess which dataset this instance belongs to, i.e : comparing $p(From_A|X=1.2)$ and $p(From_B|X=1.2)$.
However, $p(X=1.2) = 0$ since $X$ is a continuous variable and this leads to a problem because nominator and denominator of the following fraction will be $0$ :

$p(From_A|X=1.2) = \dfrac{p(X=1.2|From_A)*p(From_A)}{p(X=1.2)}$

I think discussing about $P(A|B)$ when $B$ is impossible, is meaningless. So how can we guess what dataset this instance belongs to?

• There is something mixed up here. A "data set" is usually finite, and so X cannot be continuous on this data set. Please explain the process by which you take a "random instance". – user3697176 Sep 12 '15 at 16:37
• $X$ is a feature of an instance and it can be continuous. we have 250 instances from dataset $A$ and 250 instances from dataset $B$. Now we are given an instance that value of $X$ in this instance is $X=1.2$. can you guess which dataset this instance was from? – Mohammad Sep 12 '15 at 16:54
• I can always guess :). Based on the information in your comment, I would expect my guess to be right half of the time :) – user3697176 Sep 12 '15 at 16:58
• Why not work with X in [1.2, 1.2+eps] instead and take limits as eps -> 0? – user3697176 Sep 12 '15 at 16:59
• @user3697176 : I had guessed the $0.5$ probability but it means that this probability is completely independent of $PDF$ of $X$ in each dataset which seems strange... – Mohammad Sep 12 '15 at 17:24