Question: def naivebayesPY ( X , Y ) : naivebayesPY ( X , Y ) returns [ pos , neg ] Computation of

def naivebayesPY(X, Y):
"""
naivebayesPY(X, Y) returns [pos,neg]
Computation of P(Y)
Input:
X : n input vectors of d dimensions (nxd)
Y : n labels (-1 or +1)(nx1)
Output:
pos: probability p(y=1)
neg: probability p(y=-1)
"""
# add one positive and negative example to avoid division by zero ("plus-one smoothing")
Y = np.concatenate([Y,[-1,1]])
n = len(Y)
# YOUR CODE HERE
raise NotImplementedError()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!