Skip to content

Decision tree - confusionMatrix returns error #4

Description

@enzedonline

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))

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions