close

[Solved] Accuracy Score ValueError: Can’t Handle mix of binary and continuous target

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error Accuracy Score ValueError: Can’t Handle mix of binary and continuous target in python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How Accuracy Score ValueError: Can’t Handle mix of binary and continuous target Error Occurs?

Today I get the following error Accuracy Score ValueError: Can’t Handle mix of binary and continuous target in python.

How To Solve Accuracy Score ValueError: Can’t Handle mix of binary and continuous target Error ?

  1. How To Solve Accuracy Score ValueError: Can't Handle mix of binary and continuous target Error ?

    To Solve Accuracy Score ValueError: Can't Handle mix of binary and continuous target Error accuracy_score is a classification metric, you cannot use it for a regression problem.

  2. Accuracy Score ValueError: Can't Handle mix of binary and continuous target

    To Solve Accuracy Score ValueError: Can't Handle mix of binary and continuous target Error accuracy_score is a classification metric, you cannot use it for a regression problem.

Solution 1

The problem is that the true y is binary (zeros and ones), while your predictions are not. You probably generated probabilities and not predictions, hence the result 🙂 Try instead to generate class membership, and it should work!

Solution 2

accuracy_score is a classification metric, you cannot use it for a regression problem.

You can see the available regression metrics in the docs.

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read