Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decision tree - confusionMatrix returns error #4

Open
enzedonline opened this issue Jan 2, 2022 · 0 comments
Open

Decision tree - confusionMatrix returns error #4

enzedonline opened this issue Jan 2, 2022 · 0 comments

Comments

@enzedonline
Copy link

Running the code as given, the confusionMatrix returns an error:
Error: data and reference should be factors with the same levels.

A bit of digging turns up that the function is expecting the second argument to be a factor. It can be fixed by amending the line to:
confusionMatrix(test_pred, as.factor(testing$V7))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant