[Python] How to plot multiple ROC curves in one plot with legend and AUC scores in python?

Discussão em 'Python' iniciado por Stack, Maio 23, 2025.

  1. Stack

    Stack Membro Participativo

    I am building 2 models.

    Model 1

    modelgb = GradientBoostingClassifier()
    modelgb.fit(x_train,y_train)
    predsgb = modelgb.predict_proba(x_test)[:,1]
    metrics.roc_auc_score(y_test,predsgb, average='macro', sample_weight=None)


    Model 2

    model = LogisticRegression()
    model = model.fit(x_train,y_train)
    predslog = model.predict_proba(x_test)[:,1]
    metrics.roc_auc_score(y_test,predslog, average='macro', sample_weight=None)


    How do i plot both the ROC curves in one plot , with a legend & text of AUC scores for each model ?

    Continue reading...

Compartilhe esta Página