[Python] Accuracy Score ValueError: Can't Handle mix of binary and continuous target

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

  1. Stack

    Stack Membro Participativo

    I'm using linear_model.LinearRegression from scikit-learn as a predictive model. It works and it's perfect. I have a problem to evaluate the predicted results using the accuracy_score metric.

    This is my true Data :

    array([1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0])


    My predicted Data:

    array([ 0.07094605, 0.1994941 , 0.19270157, 0.13379635, 0.04654469,
    0.09212494, 0.19952108, 0.12884365, 0.15685076, -0.01274453,
    0.32167554, 0.32167554, -0.10023553, 0.09819648, -0.06755516,
    0.25390082, 0.17248324])


    My code:

    accuracy_score(y_true, y_pred, normalize=False)


    Error message:

    ValueError: Can't handle mix of binary and continuous target

    Continue reading...

Compartilhe esta Página