Logistic Regression - Valueerror: Classification Metrics Can't Handle A Mix Of Continuous-multi Output And Binary Targets
I'm a data science noob and am working on the Kaggle Titanic dataset. I'm running a Logistic Regression on it to predict whether passengers in the test data set survived or died. I
Solution 1:
As m-dz has commented, confusion_matrix
expects 2 arrays, while in your code you pass the whole test
dataframe.
Moreover, another common mistake is not respecting the order of the arguments, which matters.
All in all, your should ask for
confusion_matrix(test['Survived'], predictions)
Solution 2:
Presumably your test
consists of booleans (lived or died) while you predictions
consist of floats (predicted probability of surviving). You should pick some threshold value and then generate booleans based on whether the predicted probability is greater than the threshold.
Post a Comment for "Logistic Regression - Valueerror: Classification Metrics Can't Handle A Mix Of Continuous-multi Output And Binary Targets"