What is the meaning of b in lesson 5 notebook?

Hi @jeremy, could you please explain what is b in the following code from lesson 5:


p = x[y==1].sum(0)+1  
q = x[y==0].sum(0)+1
r = np.log((p/p.sum())/(q/q.sum()))
b = np.log(len(p)/len(q))     # what is the meaning of this b?

The b in the last line is always evaluated to 0 because the len(p) =len(q). Isn’t it supposed to be the log ratio of class labels?


1 Like

Yes it is supposed to be - and indeed this looks to be a bug! Well spotted :slight_smile:

(In this case the two groups have equal sizes so the bug isn’t making the result any different.)