I'm not sure how I should go about this question. I've tried looking through my lecture notes but can't seem to find any way of figuring out this question
2026-03-27 06:15:32.1774592132
On
Computing the probabilty in a binary classification problem
41 Views Asked by user641579 https://math.techqa.club/user/user641579/detail At
2
There are 2 best solutions below
0
On
As @Popescu mentioned, you have to compute two probabilities for each class ($p(x|y_0)*p(y=0)$ and $p(x|y_1)*p(y=1)$). Your predicted class is the one that maximizes the probability: Here is the code in python:
import numpy as np
from scipy.stats import multivariate_normal
##Priors (assumption since its not given)
y_0 = 0.5
y_1 = 0.5
cov0= np.array([[0.5,4.5],[4.5,140]])
mean0 = [6.2,25.1]
cov1= np.array([[0.3,41.2],[1.2,30]])
mean1 = [7.3,32.4]
x = [6.8,30.1]
p0 = multivariate_normal.pdf(x, mean=mean0, cov=cov0)*y_0
p1 = multivariate_normal.pdf(x, mean=mean1, cov=cov1)*y_1
p1 = 0.01904
p0 = 0.00786
So your prediction should be 1 since p1>p0
Use Bayes' theorem - https://en.wikipedia.org/wiki/Bayes%27_theorem
You know $p(x|y)$ .Also you need the priors ,$p(y)$ . Since you don't have this information , I assume that $p(y=0) = p(y=1) = 1/2$ . Then you can compute $p(x)$ - https://en.wikipedia.org/wiki/Law_of_total_probability .