Inspecting the Strongest Coefficients
See which words drive each class.
The Model Can Explain Itself
One joy of logistic regression is transparency. Its learned coefficients reveal exactly which words push a document toward each class. 🔍
Coefficients Live in coef_
After fitting, the weights sit in clf.coef_, one number per vocabulary word. That array is the heart of the model's reasoning.
weights = clf.coef_[0]All lessons in this course
- Why Logistic Regression Wins on Text
- Training on TF-IDF Features
- Inspecting the Strongest Coefficients
- Tuning Regularization Strength