1
$\begingroup$

I'm trying to create a Bayes classificator in 1 dimension with 3 classes. I have created the following graph, where you can see that from zero to $x_{bnd1}$ is the first area $R1$, then from $x_{bnd1}$ to $x_{bnd2}$ is $R2$ and finally $R3$, from $x_{bnd2}$ to one.

The different classes

My problem is, how do I integrate in order to find the error?

Take for example the first area $R1$ where the accepted class is $ω_{1}$. The error here, I think, will be the following :

$$P\left(\omega_2 \right) \int \limits_{R_1}p\left( x |\omega_2 \right) dx + P\left(\omega_3 \right) \int \limits_{R_1}p\left( x |\omega_3 \right)dx\\$$

However, I'm not sure that this is correct. By doing this, I add the area below the red line two times, aren't I? Or is it ok to add it 2 times because it's 2 different errors?

(Of course the error will have more terms related to areas $R2, R3$, where the same problem occurs.)

In case someone wonders, the conditional pdfs I have are $$ p(x|\omega_1)=1 $$ $$p(x|\omega_2)=6x(1-x)$$ $$p(x|\omega_3)=2x$$ and the prior probabilities of the classes are $P(\omega_1)=1/6, P(\omega_2)=1/3$ and $P(\omega_3)=1/2$.

Sorry if my thoughts are a bit jumbled.. Thanks in advance.

$\endgroup$
1
$\begingroup$

You formula is correct. The error when $\omega_1$ is accepted can be written as follows; $$P(\text{making error}|\omega_1 \text{is accepted})=P(\text{making error}|x\in R_1)=P(e|x\in R_1)$$ In order to make the error, $x$ is either from class 2 or 3. Using total probability theorem, we have $$P(e|x\in R_1)=P(\text{x belongs } \omega_2|x\in R_!)+P(\text{w belongs }\omega_3|x\in R_1)$$ Then, each summand can be calculated as below: $$P(\text{x belongs }\omega_i|x\in R_1)=P(\omega_i)\int_{R_1}p(x|w_i)dx$$

$\endgroup$
  • $\begingroup$ I know, but if you look at my graph, the integrals are areas of course. If you check the integrals I've typed, what I'm actually doing is adding the area below the red line two times. Is this supposed to happen or is it wrong and I should just take the area below the green line as my error? Thanks $\endgroup$ – Thomas Nov 9 '19 at 21:00
  • $\begingroup$ It can happen. For example, what would you calculate if I ask $P(x<0.5)$? $\endgroup$ – gunes Nov 9 '19 at 21:03
  • $\begingroup$ Without determining $x$'s pdf? Hm..I guess it would be the sum of the integrals from $0$ to $0.5$ for all 3 pdfs? $\endgroup$ – Thomas Nov 9 '19 at 21:07
  • $\begingroup$ yes, but I wouldn't call them as pdfs since they're multiplied with priors, i.e. $p(\omega_1)f(x|\omega_1)$ is not a PDF. $\endgroup$ – gunes Nov 10 '19 at 9:26

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.