-2
n<-1 
a<-as.vector(length(s))
for (i in s ) {

  print(i)
  test$result<-ifelse(test$pred>i,1,0)
  a[n]<-confusionMatrix(test$result,test$churn,positive = "1")$overall[2]

  print(n)
  n=n+1
}
max(a)

How do iget the threshold value between the above range if i run the code, I get this error

Error in:$<-.data.frame(*tmp*, "result", value = logical(0)) : replacement has 0 rows, data has 3892

Calimo
  • 7,510
  • 4
  • 39
  • 61
Aditya
  • 13
  • 5

1 Answers1

0

Try test$result[[i]]<-ifelse(test$pred[[i]]>i,1,0). I think that is why you're getting that error, but I am not able to reproduce the error

nh1914
  • 11
  • 2