So I have this confusionmatrix:
confusionMatrix(d.log.newpreds, d.log$pred$obs)
Which should give me a prediction based on this:
d.log.newpreds <- factor(ifelse(d.log$pred$Yes > d.log.Thresh[1], "Yes", "No"))
With d.log$pred$Yes returns the following:
[1] 4.834351e-01 3.397934e-01 1.811117e-03 5.005784e-04 7.617364e-01 6.885630e-01 8.613468e-01
And d.log.Thresh[1] providing the following:
threshold
[1] 0.5997957
However d.log.newpreds returns the following:
[1] No
Levels: No
When I try and run the confusion matrix I get this error
Error in table(data, reference, dnn = dnn, ...) :
all arguments must have the same length
In addition: Warning message:
In confusionMatrix.default(d.log.newpreds, d.log$pred$obs) :
Levels are not in the same order for reference and data. Refactoring data to match.
Can someone provide me a workaround to get the ifelse to work properly?
Aucun commentaire:
Enregistrer un commentaire