0
$\begingroup$

I guess the math behind logistic regression computation of the three classes (c1,c2,c3) and 4 features (x1,x2,x3,x4) follow something like this. I have two question. (1) When I give input class_weight as weight then where it will appear in the formula? (2) How this formula become different between multi_class ovr (one vs rest) and multinomial case? Thanks.

p(c1) = 1/(1+exp(-y1))
p(c2) = 1/(1+exp(-y2)) 
p(c3) = 1/(1+exp(-y3))
p(c4) = 1/(1+exp(-y4))


log(p(c1) / (1- p(c1)) = w0 + w1*x1 + w2*x2 + w3*x3  + w4*x4 
log(p(c2) / (1- p(c2)) = w0 + w1*x1 + w2*x2 + w3*x3  + w4*x4 
log(p(c3) / (1- p(c3)) = w0 + w1*x1 + w2*x2 + w3*x3  + w4*x4 
log(p(c4) / (1- p(c4)) = w0 + w1*x1 + w2*x2 + w3*x3  + w4*x4 



log_reg_model = LogisticRegression(max_iter=500,penalty='l2',class_weight=weights,solver='newton-cg')
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.