Is there any way to calculate residual deviance of a scikit-learn logistic regression model? This is a standard output from R model summaries, but I couldn't find it any of sklearn's documentation.
Is there any way to calculate residual deviance of a scikit-learn logistic regression model? This is a standard output from R model summaries, but I couldn't find it any of sklearn's documentation.
model.predict_proba
normalize=False
in function metrics.log_loss()
to return the sum of the per-sample losses.So to complete @ingo's answer, to obtain the model deviance with sklearn.linear_model.LogisticRegression
, you can compute:
def deviance(X, y, model):return 2*metrics.log_loss(y, model.predict_proba(X), normalize=False)