Statsmodels score

Question:

I am running a logistic regression using statsmodels and am trying to find the score of my regression. The documentation doesn’t really provide much information about the score method unlike sklearn which allows the user to pass a test dataset with the y value and the regression coefficients i.e. lr.score(test_data, target). What and how should I pass parameters to the statsmodels‘s score function? Documentation: http://statsmodels.sourceforge.net/stable/generated/statsmodels.discrete.discrete_model.Logit.score.html#statsmodels.discrete.discrete_model.Logit.score

Asked By: Black

||

Answers:

You pass it model parameters, i.e. the coefficients for the predictors. However, that method doesn’t do what you think it does: it returns the score vector for the model, not the accuracy of its predictions (like the scikit-learn score method).

Answered By: Fred Foo

In statistics and econometrics score refers usually to the derivative of the log-likelihood function. That’s the definition used in statsmodels.

Prediction performance measures for classification or regression with binary dependent variables have largely been neglected in statsmodels.
An open pull request is here
https://github.com/statsmodels/statsmodels/issues/1577

statsmodels does have performance measures for continuous dependent variables.

Answered By: Josef

But you can always check sm.rsquared

Answered By: Aravind Prabash
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.