问题
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
回答1:
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.
回答2:
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).
来源:https://stackoverflow.com/questions/24059018/statsmodels-score