I followed these articles to implement logistic regression.

I'm confused however because after training the model and getting the weights for my variables I don't now how to use the one-hot vector to turn this into confidence scores for the different classes.

I've got the formula: y' = x1W1 + x2W2 + x3W3 + b

I've got values for all Ws and b.

I've got my one-hot vector: [[1, 0, 0], [0, 1, 0], [0, 0, 1]]

How do I combine all this into confidence for each class?


1 Answer 1


You should use softmax to convert your output in probabilities. For only two classes, you have the formula $P(x \in class 1) = \frac{\exp(y_{\text{class1}})}{\exp(y_{\text{class1}}) + \exp(y_{\text{class2}})}$. It mentioned in your article.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.