1
$\begingroup$

I am using logistic Regression for my analysis. My Accuracy score and AUC score are different

X_train, X_test, y_train, y_test =train_test_split(x, you, test_size=0.3,random_state=0) 

LogReg=LogisticRegrssion() 
LogReg.fit(X_train,y_train)

y_pred=LogReg.predict(X_test)
accuracy_score(y_test,y_pred)

accuracy_score=0.84

When I plotting Roc and Auc curve

y_scores_lr = LogReg.fit(X_train,y_train).decisio n_function(X_test) 

fpr, tpr, _=roc_curve(y_test, y_scores_lr) 
roc_auc_logreg =auc(fpr, tpr) 

roc_auc_logreg=0.87

Why there is a difference in results between accuracy_score and roc_curve function output, where I am making mistake that both of these are not matching. Any help on this to correct any error.

Thanks in advance.

$\endgroup$
2
  • $\begingroup$ If different metrics gave same results, there wouldn't be need to duplicate them, don't you think...? $\endgroup$
    – Tim
    Feb 1, 2018 at 9:08
  • $\begingroup$ Is these are same metrics or different. If same why am I different. Am I making any mistakes in the code $\endgroup$
    – StatsUser
    Feb 1, 2018 at 9:37

1 Answer 1

1
$\begingroup$

I think what Tim is alluding to is the fact that AUC and accuracy are two different metrics, hence they yield two different results.

You can find tons of resources on what accuracy is and what AUC is on this site or via the Google. For more information on how sklearn calculates accuracy or auc, you can always look at the source here and here.

$\endgroup$

Your Answer

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

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